PowerShell 远程连接与其它技巧

远程连接

•1.通过WinRM quickconfig配置可以通过WinRM访问

•2.访问WSMAN,将主机名配置到TrustedHosts

•3.通过Enter-PSSession连接主机

 

WMI远程连接

•执行远程命令Invoke-Command -ComputerName 192.168.1.110 -ScriptBlock{$p=get-process}

•访问远程对象 [WMI]'\\chsword-pc\root\cimv2:Win32_Process.Handle="1804"'

 

Profile

•$Profile即为存储 Profile文件的地址

•通过notepad $profile可以编辑

 

执行脚本

•将脚本存为ps1文件

•执行set-executionpolicy remotesigned 允许脚本执行

•输入 .\xxx.ps1 即可

posted @ 2011-10-17 22:11  重典  阅读(3202)  评论(0编辑  收藏  举报