Location: List Archives

List Archives

This forum is an archive of all posts to our mailing list over the past few years.  The forum is set read only therefore to contribute you will need to join our list community.  See more info about this here.

List Archives

Subject: [ActiveDir] Win32Shutdown Method & Win2003
Prev Next
You are not authorized to post a reply.

Page 1 of 212 > >>
AuthorMessages
dhardingUser is Offline

Posts:24

12/13/2005 10:35 AM  
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 recipientand may contain confidential or privileged information. If you are notthe intended recipient, any disclosure, copying, use or distribution ofthe information included in the message and any attachments isprohibited. If you have received this communication in error, pleasenotify us by reply e-mail and immediately and permanently delete thismessage and any attachments. Thank You.
dhardingUser is Offline

Posts:24

12/14/2005 1:25 AM  
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The shutdown command
works.  Give that a shot.

S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
jamesblairUser is Offline

Posts:0

12/14/2005 1:58 AM  
Devon

You could also utilise Winexit to logoff a server. It free
and can be configured using Group Policy by adding a template, see
attached. Some info info below from Microsoft...

http://support.microsoft.com/default.aspx?scid=kb;en-us;314999&sd=tech
http://support.microsoft.com/default.aspx?scid=kb;en-us;297267


James      

From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve
ShaffSent: Wednesday, 14 December 2005 10:38 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
The shutdown command
works.  Give that a shot.
S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding,
DevonSent: Tuesday, December
13, 2005 2:34 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.

ÿþSymantec Mail Security replaced winexit.adm with this text message. The original text contained prohibited content and was deleted.

jamesblairUser is Offline

Posts:0

12/14/2005 2:16 AM  
Template attached need to rename to
winexit.adm...forgot I added ad? to my mail security deletions
list...


James     
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Blair,
JamesSent: Wednesday, 14 December 2005 11:57 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

Devon

You could also utilise Winexit to logoff a server. It free
and can be configured using Group Policy by adding a template, see
attached. Some info info below from Microsoft...

http://support.microsoft.com/default.aspx?scid=kb;en-us;314999&sd=tech
http://support.microsoft.com/default.aspx?scid=kb;en-us;297267


James      

From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve
ShaffSent: Wednesday, 14 December 2005 10:38 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
The shutdown command
works.  Give that a shot.
S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding,
DevonSent: Tuesday, December
13, 2005 2:34 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.

Attachment:
winexit
alainlissoirUser is Offline

Posts:3

12/14/2005 2:46 AM  
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 5:23 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.
AD00000893User is Offline

Posts:0

12/14/2005 3:05 AM  
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005 5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday,
December 13, 2005 7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE:
[ActiveDir] Win32Shutdown Method & Win2003


The shutdown
command works.  Give that a shot.
S




From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding, Devon
Sent: Tuesday,
December 13, 2005 2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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/
dhardingUser is Offline

Posts:24

12/14/2005 3:47 AM  
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
AntkneeUser is Offline

Posts:0

12/14/2005 4:07 AM  
Why not use shutdown.exe?



Thank You,

Anthony Scott

Berbee

4690 E. Fulton Dr., Bldg. C

Ada, Michigan
49301

(616) 481-9722

(616) 464-6369

From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding, Devon
Sent: Wednesday, December 14, 2005
10:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir] Win32Shutdown
Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
AD000001210User is Offline

Posts:0

12/14/2005 4:38 AM  
Here
is one I use, I run it from the local machine to schedule
restarts..
I
snagged it from somewhere on the internet, credit goes to the author of this
script whoever they may be...

Mike


strComputer = "server1"Set objWMIService = GetObject("winmgmts:"
_    & "{impersonationLevel=impersonate,(Shutdown)}!\\"
& _        strComputer &
"\root\cimv2")Set colOperatingSystems = objWMIService.ExecQuery
_    ("Select * from Win32_OperatingSystem")For Each
objOperatingSystem in colOperatingSystems   
ObjOperatingSystem.Reboot()Next

-----Original Message-----From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 9:39 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Alain
LissoirSent: Wednesday,
December 14, 2005 9:38 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003


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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14, 2005 5:23
AMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S






From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand
may contain confidential or privileged information. If you are
notthe
intended recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited.
If you have received this communication in error,
pleasenotify
us by reply e-mail and immediately and permanently delete
thismessage
and any attachments. Thank You.
dhardingUser is Offline

Posts:24

12/14/2005 4:46 AM  
I would have to call that .exe from the
script, which is what I was trying to avoid.  Rather use built in wmi calls.



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott, Anthony
Sent: Wednesday, December 14, 2005
11:01 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



Why not use shutdown.exe?



Thank You,

Anthony Scott

Berbee

4690 E. Fulton Dr., Bldg. C

Ada, Michigan 49301

(616) 481-9722

(616) 464-6369

From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
10:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S



From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Harding, Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
alainlissoirUser is Offline

Posts:3

12/14/2005 5:27 AM  
On 2003? Or
2000?
Hmmm ... can
you try with this :) 

objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 7:39 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Alain
LissoirSent: Wednesday,
December 14, 2005 9:38 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003


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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14, 2005 5:23
AMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S


From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.
dhardingUser is Offline

Posts:24

12/14/2005 5:27 AM  
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
10:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
alainlissoirUser is Offline

Posts:3

12/14/2005 5:41 AM  
The aim here
is to logoff users with the WMI method Win32Shutdown (parameter 0 = Logoff), not
to shutdown the machine :)
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Za
VueSent: Wednesday, December 14, 2005 7:05 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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 \\server2c:\tools\shutdown -r
\\server3c:\tools\shutdown -r \\server4c:\tools\shutdown -r
\\server5c:\tools\shutdown -r \\server6etc. 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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14,
2005 5:23 AMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject:
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S





From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand
may contain confidential or privileged information. If you are
notthe
intended recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited.
If you have received this communication in error,
pleasenotify
us by reply e-mail and immediately and permanently delete
thismessage
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/
AntkneeUser is Offline

Posts:0

12/14/2005 6:13 AM  
Batch file would do .I am finding that, in
general, some of the commend line tools included with 2003 are much easier to
work with than wmi or _vbscript_¦ depending on what you are trying to
achieve.



Thank You,

Anthony Scott

Berbee

4690 E. Fulton Dr., Bldg. C

Ada, Michigan
49301

(616) 481-9722

(616) 464-6369

From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding, Devon
Sent: Wednesday, December 14, 2005
11:20 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



I would have to call that .exe from the
script, which is what I was trying to avoid.  Rather use built in wmi
calls.





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott, Anthony
Sent: Wednesday, December 14, 2005
11:01 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



Why not use shutdown.exe?



Thank You,

Anthony Scott

Berbee

4690 E. Fulton Dr., Bldg. C

Ada, Michigan 49301

(616) 481-9722

(616) 464-6369



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
10:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
dhardingUser is Offline

Posts:24

12/14/2005 6:36 AM  
Only I need it to just logoff, not reboot. 
It™s a very simple script.  Doesn™t make sense how it works on XP
but not Win2000 or Win2003.



Here it is again¦

Set objSystemSet = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}").InstancesOf("Win32_OperatingSystem") For Each objSystem In objSystemSet        objSystem.Win32Shutdown 0Next





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Mike Williams
Sent: Wednesday, December 14, 2005
11:16 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



Here is one I use, I run
it from the local machine to schedule restarts..

I snagged it from
somewhere on the internet, credit goes to the author of this script whoever
they may be...



Mike





strComputer =
"server1"
Set objWMIService = GetObject("winmgmts:" _
    &
"{impersonationLevel=impersonate,(Shutdown)}!\\" & _
        strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Reboot()
Next

-----Original Message-----
From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
9:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003

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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The shutdown
command works.  Give that a shot.

S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
dhardingUser is Offline

Posts:24

12/14/2005 6:43 AM  
Same error



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
11:26 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



On 2003? Or 2000?

Hmmm ... can you try with
this :) 



objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
7:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003

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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S



From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Harding, Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
darren.marelia@xxxx.yyy

12/14/2005 8:01 AM  
Devon-
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 9:52 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
Same
error



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Alain
LissoirSent: Wednesday,
December 14, 2005 11:26 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003


On 2003?
Or 2000?

Hmmm ...
can you try with this :) 



objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True


From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14, 2005 7:39
AMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Alain
LissoirSent: Wednesday,
December 14, 2005 9:38 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003


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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14, 2005 5:23
AMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.
aricbernardUser is Offline

Posts:2

12/14/2005 8:12 AM  
FWIW “ If you are sitting at the console
of the server the method works fine.  However it consistently fails with the
generic error if you are logged in via TS to session 0 or another.



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding, Devon
Sent: Wednesday, December 14, 2005
9:52 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



Same error





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
11:26 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



On 2003? Or 2000?

Hmmm ... can you try with
this :) 



objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
7:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003

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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
listmailUser is Offline

Posts:429

12/14/2005 9:09 AM  
Not being a fan of WMI I can't say why, I can offer this
though

http://www.joeware.net/win/free/tools/qlogoff.htm

which I made available here previously.

I call exes from scripts all of the time. Most often it is
the fastest, easiest, and cleanest solution.


From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 8:23 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Steve
ShaffSent: Tuesday, December
13, 2005 7:38 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003

The
shutdown command works.  Give that a shot.
S



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Tuesday, December 13, 2005 2:34
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [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
recipientand may
contain confidential or privileged information. If you are
notthe intended
recipient, any disclosure, copying, use or distribution
ofthe
information included in the message and any attachments
isprohibited. If
you have received this communication in error,
pleasenotify us
by reply e-mail and immediately and permanently delete
thismessage and
any attachments. Thank You.
dhardingUser is Offline

Posts:24

12/14/2005 9:10 AM  
Hmm¦You™re right¦it
works fine from the console.  Many of our admins logon through rdp though.  Is
there a workaround for TS sessions?



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Darren Mar-Elia
Sent: Wednesday, December 14, 2005
2:16 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



Devon-

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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
9:52 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003

Same error





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
11:26 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



On 2003?
Or 2000?

Hmmm ...
can you try with this :) 



objWMILocator.Security_.Privileges.AddAsString
"SeRemoteShutdownPrivilege", True



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
7:39 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003

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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
9:38 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
Devon
Sent: Wednesday, December 14, 2005
5:23 AM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Steve Shaff
Sent: Tuesday, December 13, 2005
7:38 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



The
shutdown command works.  Give that a shot.

S





From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On
Behalf Of Harding, Devon
Sent: Tuesday, December 13, 2005
2:34 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
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.
You are not authorized to post a reply.
Page 1 of 212 > >>

Forums >ActiveDir Mail List Archive >List Archives > [ActiveDir] Win32Shutdown Method & Win2003



ActiveForums 3.7
AdventNet Banner
Friends

Friends

Namescape
Members

Members

MembershipMembership:
Latest New UserLatest:cmilte
New TodayNew Today:1
New YesterdayNew Yesterday:2
User CountOverall:4264

People OnlinePeople Online:
VisitorsVisitors:62
MembersMembers:0
TotalTotal:62

Online NowOnline Now: