2
I'm looking for a way to restart a computer with PowerShell (Restart-Computer
), at a given time (Example: 03:00AM). The PS-Script itself will run at a random time, when the user executes it, so it's no option to schedule the script at 03:00AM.
My first thought was to schedule a task, at 03:00AM (with PowerShell) that will execute the reboot for me. This is possible (I think) with New-ScheduledTask
in PowerShell 4.0. The downside is that I'm not sure if the computers that will run this script have PowerShell 4.0.
Is it possible to schedule a task with PowerShell 2.0, or is there another way to reboot the computer at a given time?
Thank you
1you can use schtasks.exe to schedule a task - from any (power)shell. – marsh-wiggle – 2014-12-02T14:45:12.063
I'm a little confused here. Are you trying to create the task using Powershell? That's what
New-ScheduledTask
is for. If you're just looking to set up a scheduled reboot, Scheduled Tasks (the GUI) is going to be your friend here. – Tanner Faulkner – 2014-12-02T18:02:03.973I'm looking for a way to schedule a reboot, with Powershell. New-ScheduledTask is only for PowerShell 4.0. I'm going to try Boboes his approach, thank you. – Jente – 2014-12-03T07:07:50.633