Created
May 2, 2022 11:33
-
-
Save tkouba/5e1074b342b16631fd21fdc882c01482 to your computer and use it in GitHub Desktop.
Stop services in cluster resources on inactive node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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