tags:

views:

283

answers:

2

How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?

+1  A: 

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

Rob Paterson
+2  A: 

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)
Bruno Gomes