From 44c8366d022bf662817c8e3bbe59875c797ac285 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sat, 15 Jul 2017 13:05:34 +0200 Subject: [PATCH] fix restart-computer script --- scripts/computers/restart-computer.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/computers/restart-computer.ps1 b/scripts/computers/restart-computer.ps1 index 639cf82..de115a0 100644 --- a/scripts/computers/restart-computer.ps1 +++ b/scripts/computers/restart-computer.ps1 @@ -5,15 +5,16 @@ function Restart-Domain-Computer sleep 30 while ($status -eq $null) { - $test-connection-params = @{'Computername'=$computername; - 'BufferSize'=16; - 'Count'=1; - 'Quiet'} - if(Test-Connection $test-connection-params {break} + if(Test-Connection -Computername $computername ` + -BufferSize 16 ` + -Count 1 ` + -Quiet){break} Write-Host 'Still offline' sleep 5 } - Write-Host -foregroundcolor "green" $computername ' is online' + Write-Host + Write-Host -backgroundcolor "green" $computername ' is online' + Write-Host Read-Host 'Press a key to quit' }