Because I encountered a lot of strugle to create some scheduled tasks on a Windows 2003 machine with PowerShell v2.0.
I used the function of Hugo Peeters (the link within the script is broken but this was the Original source) and then I encountered a problem to pass a task with a parameter between double quotes.
Create-ScheduledTask -ComputerName $Server -TaskName '`"Name`"' -TaskRun '`"C:\WINDOWS\system32\cscript.exe \`"C:\test script\script.vbs\`"`"' -Schedule "DAILY" -StartTime "08:00" -RunAsUser "$domain\$User" -RunAsPwd $Password -Days "*"
This is the only format I used that worked to create a scheduled task to start a vbscript or another task including a parameter.
Continue reading


