Shutdown.Exe
-l -t 0
But I'm sure
that many other people have many other good tool to
suggest. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Harding, Devon Sent: Thursday, December 15, 2005 8:15 AM To: ActiveDir@mail.activedir.org Subject: RE: [ActiveDir] Win32Shutdown Method & Win2003 All of the below are
correct. I’m running the script by itself just to work out this
part. On 2003(SP1) servers, we get the Generic Failure, on 2000 systems,
it does nothing. What would be a good
external tool in the meantime? From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Alain
Lissoir Ok. I
think we are facing a bug in the TS context with WMI. Let me investigate. I will
file a bug about this. I gonna get back to you but this may take a little
while. I
understand that: - You
are an admin of the box. - The WMI
privileges are granted in the script - You are
TSing into a 2003 server - You
cannot logoff or even shutdown the system with the Win32Shutdown method even
with the Force (4) flag. - In which
context are you running that script? Not a logon script I presume, right? :) Can
you give me more data about your scenario? - Are you
2003 RTM or SP1? Please
answer these questions. In the
meantime, you will have to shell an external tool
... From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Force (4)
also gives the same result. Generic Error. And does not log off the
user. From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Kamlesh
Parmar YUP, you
should add 4, Here is some code Const LOGOFF = 0 Const SHUTDOWN = 1 Const REBOOT = 2 Const FORCE = 4 Const POWEROFF = 8 For Each objPC In GetObject("winmgmts:{(shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
objPC.Win32Shutdown LOGOFF + FORCE Next
On 12/15/05,
Darren Mar-Elia <[EMAIL PROTECTED]>
wrote: Are you
getting an actual error or just that it doesn't work? I ran your script on my
test W2003 box and it worked just fine. I ran it as administrator at the
server's console. How are you running this script? At the console or in a TS
session? The latter may be problematic. Also, you might want to
try: objSystem.Win32Shutdown
4
which I
think is forced logoff. That would get around issues where some process is
preventing the normal logoff. Darren From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of
Same
error From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]] On
Behalf Of Alain Lissoir On 2003? Or
2000? Hmmm ... can you try
with this :) objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True 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