The aim here is to logoff users with the WMI method Win32Shutdown (parameter 0 = Logoff), not to shutdown the machine :)


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Za Vue
Sent: Wednesday, December 14, 2005 7:05 AM
To: ActiveDir@mail.activedir.org
Subject: Re: [ActiveDir] Win32Shutdown Method & Win2003

I use PsShutdown.exe from  www.systeminternals.com(free).  Create single batch file and run it.

Here is my batch script to reboot all servers at once.
c:\tools\shutdown -r \\server1 (-r restart the machine)
c:\tools\shutdown -r \\server2
c:\tools\shutdown -r \\server3
c:\tools\shutdown -r \\server4
c:\tools\shutdown -r \\server5
c:\tools\shutdown -r \\server6
etc. etc.

PsShutdown.exe is just renamed to shutdown.exe.

-Z.V.
Alain Lissoir wrote:
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 Harding, Devon
Sent: Wednesday, December 14, 2005 5:23 AM
To: ActiveDir@mail.activedir.org
Subject: RE: [ActiveDir] Win32Shutdown Method & Win2003

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
Sent: Tuesday, December 13, 2005 7:38 PM
To: ActiveDir@mail.activedir.org
Subject: RE: [ActiveDir] Win32Shutdown Method & Win2003

The shutdown command works.  Give that a shot.

S


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Harding, Devon
Sent: Tuesday, December 13, 2005 2:34 PM
To: ActiveDir@mail.activedir.org
Subject: [ActiveDir] Win32Shutdown Method & Win2003

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

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.

List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to