This repository has been archived on 2020-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
2017-07-14 23:58:11 +02:00
|
|
|
function Restart-Domain-Computer
|
|
|
|
{
|
|
|
|
$computername = Read-Host 'Please enter a computer name'
|
|
|
|
Restart-Computer -Force -ComputerName $computername
|
|
|
|
sleep 30
|
|
|
|
while ($status -eq $null)
|
|
|
|
{
|
2017-07-15 13:05:34 +02:00
|
|
|
if(Test-Connection -Computername $computername `
|
|
|
|
-BufferSize 16 `
|
|
|
|
-Count 1 `
|
|
|
|
-Quiet){break}
|
2017-07-14 23:58:11 +02:00
|
|
|
Write-Host 'Still offline'
|
|
|
|
sleep 5
|
|
|
|
}
|
2017-07-15 13:05:34 +02:00
|
|
|
Write-Host
|
|
|
|
Write-Host -backgroundcolor "green" $computername ' is online'
|
|
|
|
Write-Host
|
2017-07-14 23:58:11 +02:00
|
|
|
Read-Host 'Press a key to quit'
|
|
|
|
}
|
|
|
|
|
|
|
|
Restart-Domain-Computer
|