Here is the exact code and error: Set objSystemSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem") For Each objSystem In objSystemSet objSystem.Win32Shutdown(0) Next C:\>cscript logoff.vbs Microsoft (R) Windows Script Host Version
5.6 Copyright (C) Microsoft Corporation
1996-2001. All rights reserved. C:\logoff.vbs(4, 5) SWbemObjectEx: Generic
failure From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of I still get the same
error running on a server: Generic Error It seem to be giving an
error right at this point: objSystem.Win32Shutdown 0 Here is the whole script: Set objWMILocator =
CreateObject ("WbemScripting.SWbemLocator") objWMILocator.Security_.Privileges.AddAsString
"SeShutdownPrivilege", True Set objWMIServices =
objWMILocator.ConnectServer(strComputerName, cWMINameSpace, strUserID,
strPassword) Set objSystemSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem") For Each objSystem In
objSystemSet
objSystem.Win32Shutdown 0 Next From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alain Lissoir Have you
tried your script as a plain admin on server? I wonder if it is not a question
of privileges ... Try to
add to your script the following before connecting to the Root\CIMv2 namespace.
Then retry ... Set
objWMILocator=CreateObject ("WbemScripting.SWbemLocator")
objWMILocator.Security_.Privileges.AddAsString "SeShutdownPrivilege",
True
Set objWMIServices = objWMILocator.ConnectServer(strComputerName,
cWMINameSpace, strUserID, strPassword) From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of This
script is part of a another script that upon logon, checks certain registry
values, then if the values are not set, the script then sets the value and
logoff the current user. Like I said before, it works on Windows XP but
not servers. Why? From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Shaff The
shutdown command works. Give that a shot. S From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of I’m using the following script
to logoff a workstation. It works fine on XP workstations but does not seem
to work on Windows 2000/2003 servers. Any Ideas? Set objSystemSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem") For Each objSystem In objSystemSet
objSystem.Win32Shutdown 0 Next Windows
Systems Engineer Southern
Wine & Spirits - BSG 954-602-2469 __________________________________ |
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Harding, Devon
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Alain Lissoir
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Scott, Anthony
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Harding, Devon
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Harding, Devon
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Darren Mar-Elia
- Re: [ActiveDir] Win32Shutdown Method & Win200... Kamlesh Parmar
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Bernard, Aric
- RE: [ActiveDir] Win32Shutdown Method & Win2003 joe
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Harding, Devon
- RE: [ActiveDir] Win32Shutdown Method & Win2003 Bernard, Aric