Saturday, 25 July 2015

PowerShell Script Scheduler / Automator

This little script is designed for those occasions where
you want to schedule / automate the running of a PowerShell script, but are
stymied by Enterprise restrictions preventing you from setting up standard
Windows scheduled tasks. This PowerShell script will schedule on a daily basis
(specific minute - but not exactly on the minute - of a specific hour of
specific days of the week.) It’s simple and solves a problem. It does require
the user running the script (and whatever script the script needs to run), to
remain logged in (and I’d recommend logged into the console session); and after a reboot, the user will need to be logged back in again and the scheduler re-started
(perhaps a simple batch file to kick it of.)

The code (formatted for blogger) is below. As always,
copy and paste into a text editor and save as say “PS-Script-Scheduler.ps1”.