How do I use PowerShell to stop and start a clustered “Generic Service”?
-
02-07-2019 - |
Question
How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?
Solution
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)
OTHER TIPS
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow