Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

command not running

$
0
0

I have this code:

$GetBootValue1 = (get-ItemProperty hklm:\SOFTWARE\MGH).OneHour

if ($GetBootValue1 = '1') 

{ remove-itemproperty -path HKLM:\Software\MGH -name OneHour | Start-Sleep -s 30 | shutdown.exe /i /r /t 3600 /c "Your computer will be rebooted in 3 minutes as part our MGH computer maintenance process.  Please close all open program." }

 

The reg key does exist and the shutdown does run.  But the Start-Sleep -s 30 does Not run.  Why?   I run this and the Shutdown /i (GUI option) pops up right away, there is no 30 second delay.  No errors either.

Viewing all articles
Browse latest Browse all 6937

Trending Articles