Created
April 6, 2018 01:43
-
-
Save giseongeom/47a1feba3d8a31795d76322bbbb01f5d to your computer and use it in GitHub Desktop.
Find a few windows services that has recovery action configured
This file contains hidden or 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
| $vmlist = Get-ADComputer -Filter "Name -like 'P*'" | Select-Object -ExpandProperty Name | |
| foreach ($vm in $vmlist) | |
| { | |
| icm -ComputerName $vm -ScriptBlock { | |
| $live_services = get-service live_* | |
| foreach ($live_service in $live_services) | |
| { | |
| $check_result = (sc.exe qfailure $live_service | Select-String failure_actions).length | |
| if ($check_result -gt 0) { Write-Host $env:COMPUTERNAME - $live_service.Name has recovery configured } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment