Skip to content

Instantly share code, notes, and snippets.

@tkouba
Created May 2, 2022 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkouba/5e1074b342b16631fd21fdc882c01482 to your computer and use it in GitHub Desktop.
Save tkouba/5e1074b342b16631fd21fdc882c01482 to your computer and use it in GitHub Desktop.
Stop services in cluster resources on inactive node.
# Selects cluster groups which are not owned by current node
# then select resources with type 'Generic Service'
# then select 'Running' services
# and stop them
(Get-ClusterGroup | Where-Object {$_.OwnerNode -ne $env:COMPUTERNAME} | Get-ClusterResource) | Where-Object {$_.ResourceType -eq 'Generic Service'} | Get-Service | Where-Object {$_.Status -eq 'Running'} | Stop-Service -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment