Hello everyone.
I have a question for you. I need to create a Sceduled Task to run a script on remote machine. Below is the code I use for training, so to speak. This code fails with Error 22. What might be the reason?
I've been trying to execute this code on virtual machines running XP. I'm logged on as Administrator on all machines and the script fails even when executed locally as in this sample.
Thank you in advance.
I have a question for you. I need to create a Sceduled Task to run a script on remote machine. Below is the code I use for training, so to speak. This code fails with Error 22. What might be the reason?
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set objNewJob =
objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
("Notepad.exe", "********074500.000000-240", _
True , , , , JobID)
Wscript.Echo errJobCreated
I've been trying to execute this code on virtual machines running XP. I'm logged on as Administrator on all machines and the script fails even when executed locally as in this sample.
Thank you in advance.