The Win32_scheduledJob class uses the same interface as at.exe so the
resulting processes use the local system context to run under.
set svc = GetObject("winmgmts:root\cimv2")
set obj = svc.get("Win32_ScheduledJob")
Set objMethod = obj.Methods_("Create")
Set objInParam = objMethod.inParameters.SpawnInstance_()
objInParam.RunRepeatedly = True
objInParam.Command = "calc.exe"
objInParam.InteractWithDesktop = true ' default is false
objInParam.StartTime = "********032200.000000-300" ' these stars must be
here according to the description on this input param
objInParam.DaysOfWeek = 64 ' this is a bit value see the docs on msdn to see
what they mean
Set objOutParam = obj.ExecMethod_("Create", ObjInParam)
if err = 0 then
if objOutParams.ReturnValue <> 0 then
wscript.echo "Method was called successfully but failed with code "
& objOutParams.ReturnValue
else
wscript.echo "Created the job"
end if
else
wscript.echo "Error: " & err.description
end if