Hmm. You might want to trap for errors after each operation to see where its failing. It could be a timing issue, I suppose, but that shouldn't matter for querying WMI. Assuming your scripts are running asynchronously (the default) maybe try putting a sleep into the script at the beginning to see if it is a timing issue where the user environment is not available when the script is running.
 
 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon
Sent: Monday, January 09, 2006 9:08 AM
To: [email protected]
Subject: RE: [ActiveDir] Schedueled Tasks script in GPO

The script works with the non-privileged user logged in.  Just not through the GPO.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Darren Mar-Elia
Sent: Monday, January 09, 2006 11:55 AM
To: [email protected]
Subject: RE: [ActiveDir] Schedueled Tasks script in GPO

 

Does the user running the job have the privileges to create and modify AT jobs?

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon
Sent: Monday, January 09, 2006 8:25 AM
To: [email protected]
Subject: [ActiveDir] Schedueled Tasks script in GPO

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