这可以用来停止服务:
(Get-WmiObject Win32_Service -filter "name='IPEventWatcher'" -ComputerName Server01).StopService()
如果远程机器的数量更多,我们如何平行执行相同的操作;执行时间可以减少。
答案 0 :(得分:0)
查看PSParallel模块。
你会像这样运行它:
@("server1","server2") | Invoke-Parallel { [PSCustomObject] @{Server=$_;Result=(Get-WmiObject Win32_Service -filter "name='IPEventWatcher'" -ComputerName $_).StopService()}}