Task Scheduler Resource

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 2 years, 5 months ago.

  • Author
  • #22181
    Profile photo of Aravinda Cat
    Aravinda Cat

    Hi All,

    Is there any resource available in DSC kit using which I can schedule a task in Windows Server 2012 ?
    If there is no resource how can I achieve the below powershell code in DSC?

    schtasks /create /tn "IISLogRetention" /tr "powershell.exe $executionpath" /sc daily /st 03:00:00 /ru System


  • #22222
    Profile photo of Don Jones
    Don Jones

    You can see the complete DSC Resource Kit at https://gallery.technet.microsoft.com/scriptcenter/DSC-Resource-Kit-All-c449312d. As you can see, there doesn't appear to currently be a resource for managing scheduled tasks. That means you'd have to write your own resource.

    The "Hey Scripting Guy" blog on Microsoft recently ran an entire series on managing scheduled tasks in PowerShell. You could probably use that as a starting point for authoring a resource. Mind you, the blog wasn't about authoring resources – you'll need to know how to do that.

You must be logged in to reply to this topic.