Author Posts

June 3, 2016 at 2:16 pm

I need to schedule tasks on Windows 2008 R2 that would run as system/local service so they could be run when no users are logged in without saving a password. Can I do it using register-ScheduledJob?

Here is a sample job

$trigger = New-JobTrigger -Once -At 7am -RepetitionDuration ([TimeSpan]::MaxValue) -RepetitionInterval  (New-TimeSpan -Minutes 60)
Register-ScheduledJob -Name Test-Trigger $trigger -ScriptBlock {get-service}

June 3, 2016 at 3:45 pm

I have done this in the past with Register-ScheduledTask.

June 3, 2016 at 3:58 pm

Thanks Wes, but Register-ScheduledTask only available starting Windows 2012.

June 3, 2016 at 5:36 pm

This link explains how to schedule tasks on earlier version of windows: http://www.verboon.info/2013/12/powershell-creating-scheduled-tasks-with-powershell-version-3/

But I say that I am bit surprise that Register-ScheduledTask is not available on Windows 2008 with powershell 4/5.

Eugene