register-ScheduledJob as local system

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of eugene r eugene r 6 months, 1 week ago.

  • Author
    Posts
  • #41643
    Profile photo of eugene r
    eugene r
    Participant

    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}
    
  • #41661
    Profile photo of Wes Stahler
    Wes Stahler
    Participant

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

  • #41664
    Profile photo of eugene r
    eugene r
    Participant

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

  • #41666
    Profile photo of eugene r
    eugene r
    Participant

    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

You must be logged in to reply to this topic.