hongleimi 发表于 2017-6-21 16:40:16

常用的Powershell命令

  打开Powershell (run as administrator)

[*]get-command: 搜索相关命令   eg:get-command "*VM" 搜索包含 VM的命令
[*]update -help :将帮助文档更新到最新版本      (同:help -update)
[*]helpnew-VM: 获取new-VM 帮助文档   help new-VM -examples查看示例
[*]ipconfig /all查看IP地址   Get-NetIPconfiguration-detailed   查看ip的详细信息
[*]Get-NetAdapter: 查看网卡信息   Get-NetAdapterStatistics (Recieved/send package number)      Get -NetIpAddress
[*]配置IP地址:New-NetIPAddress    netsh interface : 网路配置命令行      helpNew-NetAddress -examples      get-command "*IPAddress"   获取含有ipAddress 命令
[*]配置DNS: Set-DNSClientServerAddress

[*]网络查错:   pingTracert 或 Telnet 判断路由或者端口是否打开

  tracert: 路由跟踪 telnet: 远程访问

[*]

[*]ping 远程服务器Test-NetConnectionwww.baidu.com
[*]telnet端口:    Test-NetConnection8.8.8.8 -port:53
[*]跟踪路径:         Test-NetConnection8.8.8.8 -traceroute 103.235.46.39 -TraceRoute

[*]重启服务   restart -service
[*]获取当前服务   get-service |out-gridview

[*]out-gridview 输出格式所有的PS命令通用。可以把结果用表格形式输出来

[*]停止开始 配置服务

[*]stop-service停止服务
[*]start-service 开启服务
[*]set-service设置服务

[*]AD 和域的操作

[*]  Rename-computer***

[*]重启电脑restart -computer

[*]  shutdown /r/f/t

[*]关机       shutdown -computer
[*]加入域    Add-computer -domainnametest.com
[*]修复AD(active Directory)的信任关系 

[*]AD 存储了有关网络对象的信息并让管理员和用户能够轻松查找和使用信息。 一般退出域 重启 重新加域 重启回判断True 表示OK Flase 表示 无法连接AD 需要提供管理员密码修复
[*]命令:Test-computersecureChannel -credential domain\admin -repair 

[*]配置防火墙 profile

[*]set-netfirewallprofile
[*]Set-netfirewallprofile -Profile Domain, public, Private, -Enabled true打开 Domain public private 的防火墙

[*]配置防火墙策略

[*]New-netfirewallrule

[*]添加role 和feature

[*]install -windowsfeature
[*]install -windowsfeaturenet-framework-core -source d:\sources \sxs

[*]重启AD用户密码

[*]Convert -securestring设置一个加密密码

[*]定位 FSMO(flexible single master operation)灵活单主机操作

[*]Get-ADForest test.com|FT SchemaMaster (架构主机)
[*]Get-ADForest test.com|FT RidMaster(获取域 test.com 的Rid 主机)

[*]迁移FSMO (营运主机)

[*]Move-ADDirectoryServer OperationMasterRole

[*]查看hotfix

[*]get-hotfix

[*]Hyper-v 下powershell 命令

[*]get-command -module Hyper-v "*VM*"|measure

[*]配置虚拟网络 (创建VM后 分配虚拟网络)

[*]Get-VM
[*]Get-VMNetworkAdapter
[*]connnect-VMNetWorkAdapter

[*]创建还原点

[*]get-VM|checkpoint -VM               

页: [1]
查看完整版本: 常用的Powershell命令