天天看點

Powershell: schedule job in Powershell

http://blogs.technet.com/b/heyscriptingguy/archive/2012/09/18/create-a-powershell-scheduled-job.aspx

$dailyTrigger = New-JobTrigger -Daily -At "2:00 PM"
$option = New-ScheduledJobOption -StartIfOnBattery -StartIfIdle
Register-ScheduledJob -Name UpdateHelp -ScriptBlock {Update-Help -Module * -Force} -Trigger $dailyTrigger -ScheduledJobOption $option

To look at the scheduled job, open the Task Scheduler MMC by typing the following command.
Taskschd.msc
           

Need note that Powershell schedule job is actually create task in Windows task scheduler, if you have no permission to task scheudler (e.g. on your company PC), you are unable to do this in Powershell as well. 

繼續閱讀