none
Task Scheduler 2 VB Script RRS feed

  • Question

  •     I'm looking for sample code for a vb script that adds a task to the task scheduler/
    Wednesday, December 29, 2010 1:48 PM

Answers

All replies

  • check out this sample code:

    http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/taskscheduling/


    Thiyagu | MCTS/MCITP - Exchange 2007 | MCSE 2003[Messaging] | http://www.myExchangeWorld.com. This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by IamMred Thursday, December 30, 2010 4:51 PM
    Wednesday, December 29, 2010 2:29 PM
    Moderator
  • one more

    http://msdn.microsoft.com/en-us/library/aa394601%28v=VS.85%29.aspx


    Thiyagu | MCTS/MCITP - Exchange 2007 | MCSE 2003[Messaging] | http://www.myExchangeWorld.com. This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by IamMred Thursday, December 30, 2010 4:51 PM
    Wednesday, December 29, 2010 2:31 PM
    Moderator
  •     The ("Win32_ScheduledJob") method the sample uses is very limited.   Is there a sample that shows me how I can schedule a task where I specify the job title, how long the job can run, and all the other items I can specify if I create a job using the interactive job tool?
    Wednesday, January 19, 2011 2:48 AM
  • Hi,

    You can shell out using a "schtasks.exe" command to add the task and execute the command using either wshShell.Run or wshShell.Exec within your script. The command syntax is:

    schtasks.exe /create /s \\servername /ru system /sc once /tn RestartSystem /tr "C:\Scripts\RestartSystem\RestartSystem.vbs" /st 03:00 /sd 19/01/2011"

    Please let me know if you need further help with this.

    Cheers Matt :)

    Wednesday, January 19, 2011 3:33 AM
    Moderator
  • Perfect, much better than those annoying scripts, and it appears to know the system's time zone, none of that annoying utc adjustment.
    Wednesday, January 19, 2011 4:47 AM