如何通过并行执行使用PowerShell来停止和禁用远程机器中的srvice?

时间:2016-06-24 07:42:06

标签: powershell

这可以用来停止服务:

(Get-WmiObject Win32_Service -filter "name='IPEventWatcher'" -ComputerName Server01).StopService()

如果远程机器的数量更多,我们如何平行执行相同的操作;执行时间可以减少。

1 个答案:

答案 0 :(得分:0)

查看PSParallel模块。

你会像这样运行它:

@("server1","server2") | Invoke-Parallel { [PSCustomObject] @{Server=$_;Result=(Get-WmiObject Win32_Service -filter "name='IPEventWatcher'" -ComputerName $_).StopService()}}