Hello,

I have a script that runs faultlessly until it attempts to access a server on
which my admin account has no access privileges. The script stops cold. On
Error Resume Next does not work. How do I get past this - short of changing my
admin account's access privileges - an impossibility in my environment.

All suggestions will be greatly appreciated.

Thanks,
Bill Burke
bill@2burkes.com

'**************************************************************
'************************** SNIP ****************************
For Each strComputer In arrTargetComputer
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colTimeZone = objWMIService.ExecQuery ("Select * from Win32_TimeZone")
For Each objTimeZone In colTimeZone
If objTimeZone.DayLightBias = 0 Then
If objTimeZone.Bias >= 0 Then
objTZoffsetMinutes = "+" & objTimeZone.Bias
Elseif objTimeZone.Bias < 0 Then
objTZoffsetMinutes = objTimeZone.Bias
End If
Else
If objTimeZone.Bias = 0 Then
objTZoffsetMinutes = "+" & (objTimeZone.Bias)
Elseif objTimeZone.Bias >0 Then
objTZoffsetMinutes = "+" & (objTimeZone.Bias - 60)
Elseif objTimeZone.Bias < 0 Then
objTZoffsetMinutes = (objTimeZone.Bias + 60)
End If
End If
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")_
Set objScheduledJob = objWMIService.Get("Win32_ScheduledJob")

patchJobCreated = objScheduledJob.Create_
& ("D:\Windows2000-KB824146-x86-ENU.exe", arrTimeToPatchValue(strPatchTime)_
& objTZoffsetMinutes, False , , , , JobID)

ShutdownJobCreated = objScheduledJob.Create_
& ("D:\Shutdown.exe /L /R /Y /C", arrTimeToRebootValue(strRebootTime) _
& objTZoffsetMinutes, False , , , , JobID)
Next

'**************************************************************
'************************** SNIP ****************************

Re: Script stops on access permissions error by Michael

Michael
Thu Sep 18 20:35:44 CDT 2003

Bill wrote:
> Hello,
>
> I have a script that runs faultlessly until it attempts to access a
> server on which my admin account has no access privileges. The
> script stops cold. On Error Resume Next does not work. How do I get
> past this - short of changing my admin account's access privileges -
> an impossibility in my environment.
>
> All suggestions will be greatly appreciated.


See my reply to the email you sent me from your yahoo account this
morning...


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

System Administration Scripting Guide - samples scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en