View Single Post
Old 06-25-2009   #1 (permalink)
Mr L


 
 

scheduling a task and renaming it

Hi

I need to script a scheduled task on a number of servers, and would like to
give it an easy to understand name. But, by default they're given a name on
the form at1 or at2 etc. How can this easilly be achieved?

The script I'm using is as follows:

Dim strComputer
Dim args

Set args = Wscript.Arguments
strComputer = args.Item("0")

If (strComputer = "") then
Usage
Else
Sheduler
End if

sub sheduler (strComputer)

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

JobID = "PendingInfoCheck"

Set objNewJob = objWMIService.Get("Win32_ScheduledJob")

errJobCreated = objNewJob.Create _
("C:\config\PendingInfo\PendingInfoV3.vbs", "********040000.000000-000",
_
True , 1 OR 2 OR 4 OR 8 OR 16 OR 32 OR 64, , , JobID)
Wscript.Echo errJobCreated

End sub


My System SpecsSystem Spec