objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strcomputer & "\root\cimv2")
objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("C:\temp\reboot.vbs", "********012500.000000-420", _
True, 4, , True)
If errJobCreated <> 0 Then
MsgBox(errJobCreated.ToString)
Else
MsgBox("Task created")
End If
|