M
Mark
I have a script that depending on the day of the week will shutdown,
logoff, reboot or lock the computer when the user clicks on it. Since
upgrading machines to XP SP2 on the nights where the machine shuts down the
machines take forever (one we let go 1.5 hours before we powered the
machine off). The following is what is run to shut down the machine
Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}//./root/cimv2").ExecQuery("SELECT
* FROM Win32_OperatingSystem WHERE Primary = true")
Sub ShutDownWindows(dayofweek)
answer = MsgBox("Shut Down Windows?" & vbCrLf & "Warning: Save data
first!" & vbCrLf & "Click NO to cancel shutdown and save data.", vbQuestion
+ vbYesNo, dayofweek & " - Shut Down")
Select Case answer
Case vbYes
For Each OpSys In OpSysSet
outParam = OpSys.Win32Shutdown(8) 'Power Off
If err.number <> 0 Then
WScript.echo "Error number: " & Err.Number & vbNewLine &
"Description: " & Err.Description
End If
Next
Case vbNo
Msgbox "Shut down cancelled."
End Select
WScript.Quit
End Sub
Anyone have any ideas what might have changed with the upgrade to SP2?
Machines that are still on Windows XP SP1 or Windows 2000 work just as they
should.
Thanks for any help.
Mark
logoff, reboot or lock the computer when the user clicks on it. Since
upgrading machines to XP SP2 on the nights where the machine shuts down the
machines take forever (one we let go 1.5 hours before we powered the
machine off). The following is what is run to shut down the machine
Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}//./root/cimv2").ExecQuery("SELECT
* FROM Win32_OperatingSystem WHERE Primary = true")
Sub ShutDownWindows(dayofweek)
answer = MsgBox("Shut Down Windows?" & vbCrLf & "Warning: Save data
first!" & vbCrLf & "Click NO to cancel shutdown and save data.", vbQuestion
+ vbYesNo, dayofweek & " - Shut Down")
Select Case answer
Case vbYes
For Each OpSys In OpSysSet
outParam = OpSys.Win32Shutdown(8) 'Power Off
If err.number <> 0 Then
WScript.echo "Error number: " & Err.Number & vbNewLine &
"Description: " & Err.Description
End If
Next
Case vbNo
Msgbox "Shut down cancelled."
End Select
WScript.Quit
End Sub
Anyone have any ideas what might have changed with the upgrade to SP2?
Machines that are still on Windows XP SP1 or Windows 2000 work just as they
should.
Thanks for any help.
Mark