如何使用PowerShell停止和启动“通用服务”,如Microsoft“群集管理器”软件中所示?
You can also use WMI. You can get all the Generic Services with:
$services = Get-WmiObject -Computer "Computer" -namespace 'root\mscluster' `
MSCluster_Resource | Where {$_.Type -eq "Generic Service"}
To stop and start a service:
$timeout = 15
$services[0].TakeOffline($timeout)
$services[0].BringOnline($timeout)
It turns out the answer is to simply use the command line tool CLUSTER.EXE to do this:
cluster RES MyGenericServiceName /OFF
cluster RES MyGenericServiceName /ON
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.