Skip to content

Instantly share code, notes, and snippets.

@giseongeom
Created April 6, 2018 01:43
Show Gist options
  • Select an option

  • Save giseongeom/47a1feba3d8a31795d76322bbbb01f5d to your computer and use it in GitHub Desktop.

Select an option

Save giseongeom/47a1feba3d8a31795d76322bbbb01f5d to your computer and use it in GitHub Desktop.
Find a few windows services that has recovery action configured
$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