通过 Invoke-WmiMethod 启用 Remoting 17


微群有人问“不通过远程桌面如何启用 Remoting”。

试了一下,3.0 以后可以通过 Invoke-WmiMethod 来实现。

不过前提条件是可以通过 WMI 来访问远程机器。可以通过下面的命令进行测试。

Get-WmiObject -Class win32_computersystem -ComputerName "yourserver" -Credential (Get-Credential administrator)

如果能成功返回,就可以通过下面的命令来开启 Remoting 啦!

Invoke-WmiMethod -ComputerName "yourserver" -Class win32_process -Name Create -Args "powershell Enable-PSRemoting -Force" -Credential (Get-Credential administrator)

2.0 由于存在 double-hop 问题,无法直接启用成功,可以参考 Program: Remotely Enable PowerShell Remoting

本文链接: https://www.pstips.net/using-invoke-wmimethod-enable-remoting.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

回复 J 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

17 条评论 “通过 Invoke-WmiMethod 启用 Remoting