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.
control-ad/scripts/computers/restart-computer.ps1
2017-07-15 10:47:35 +02:00

21 lines
657 B
PowerShell

function Restart-Domain-Computer
{
$computername = Read-Host 'Please enter a computer name'
Restart-Computer -Force -ComputerName $computername
sleep 30
while ($status -eq $null)
{
$test-connection-params = @{'Computername'=$computername;
'BufferSize'=16;
'Count'=1;
'Quiet'}
if(Test-Connection $test-connection-params {break}
Write-Host 'Still offline'
sleep 5
}
Write-Host -foregroundcolor "green" $computername ' is online'
Read-Host 'Press a key to quit'
}
Restart-Domain-Computer