Created
August 24, 2016 17:10
-
-
Save Kgirthofer/cec34ff34b20932ad08f0b9c5c2bf665 to your computer and use it in GitHub Desktop.
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
$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