Casual guess?
Permissions.  The context it would run under if in a logon script should be the user logging on which would likely not be able to perform this function.
 
You could check the security logs if you're auditing else place some error checking and have it write out an error code if needed.

 
On 1/9/06, Harding, Devon <[EMAIL PROTECTED]> wrote:

When I run this script manually, it works and deletes system created At jobs.   But when I place this in a logon script in GPO, it doesn't run.  Any reason why?

 

On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colScheduledTasks = objWMIService.ExecQuery _

    ("Select * from Win32_ScheduledJob")

For Each objTask in colScheduledTasks

    intJobID = objTask.JobID

    Set objInstance = objWMIService.Get _

        ("Win32_ScheduledJob.JobID=" & intJobID)

    objInstance.Delete

Next

 

Devon Harding

Windows Systems Engineer

Southern Wine & Spirits - BSG

954-602-2469

 


__________________________________
This message and any attachments are solely for the intended
recipient and may contain confidential or privileged information.
If you are not the intended recipient, any disclosure, copying, use
or distribution of the information included in the message and any
attachments is prohibited. If you have received this communication
in error, please notify us by reply e-mail and immediately and
permanently delete this message and any attachments. Thank You.


Reply via email to