NOTE: I highly recommend that you create a folder in Task Scheduler for your company name. Do not mix your scheduled tasks with those that are there under various Windows features.

Open Windows “Task Scheduler”, and create a task. Give it a name and a schedule. The part most people have questions about is the “Action Tab”.

For the Program/Script, just specify “Powershell” (it doesn’t need any directory name), then in the “add arguments” specify something like this:

-command ". 'e:\Scripts\Scheduled\PurgeOldBizTalkArchiveFiles.ps1'"

This is illustrate in the screen shot below:

You can also pass parameters from the scheduled job to the PowerShell, see
StackOverflow How to Handle Command Line Arguments

Filed under: Powershell