• Schedule Server Reboot in WS08 R2 with Powershell

    by  • 2010/10/20 • Tech • 0 Comments

    Scheduling a WS03 box to restart is very simple, I’ve done it more times than I can recall.

    To get a WS08 box to restart using Powershell requires a few things.

    1. The execution policy needs to be set to allow scripts to run.

    2. The script needs to be written.

    3. The task needs to be scheduled.

    The server’s execution policy should be set to RemoteSigned, if it isn’t already.
    In Powershell: Set-ExecutionPolicy RemoteSigned

    The Powershell command to reboot a computer is Restart-Computer.
    Open Notepad, type Restart-Computer and save the file as with the extension of PS1.

    Scheduling the task is a bit trickier, unlike a batch file the scheduler won’t run a PS1 script automatically.

    When setting up the scheduled task, on the “Start a Program” screen, put “Powershell.exe” in the Program/Script box and in the Arguments box put “-NoLogo -File C:PathtoScript.ps1” (don’t forget to put quotes around the file path if there are any space).

    Note: What happens if you put your script in the Program/Script box?  The script opens in Notepad.


    Clint McGuire is a Computer Consultant based out of Vancouver Canada. He specializes in VMware and Storage.

    Leave a Reply

    Your email address will not be published. Required fields are marked *