Skip to content

Instantly share code, notes, and snippets.

@Kgirthofer
Created August 24, 2016 17:10
Show Gist options
  • Save Kgirthofer/cec34ff34b20932ad08f0b9c5c2bf665 to your computer and use it in GitHub Desktop.
Save Kgirthofer/cec34ff34b20932ad08f0b9c5c2bf665 to your computer and use it in GitHub Desktop.
$servers = @(”ServerNames","AnotherServerName")
Start-Sleep -Seconds 15
Foreach ($server in $servers) {
$count = 0
while ( (Get-Service -Name TermService -ComputerName $server).Status -ne "Running" ) {
"Waiting for $server ..."
Start-Sleep -Seconds 20
$count ++
if ($count -eq 25){break :FailCheck}
}
:FailCheck while((Get-Service -Name TermService -ComputerName $server).Status -ne "Running" ){
"***********************************"
"Final Test For Server $server"
"***********************************"
Get-Service -Name TermService -ComputerName $server -ErrorAction Stop
}
"server Is Online and Terminal Services are running - $server is a Success!"
}
"All Servers Restarted and Online! Nice! Reporting Success to Previous Jobs..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment