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 2 of 2<< < 12
AuthorMessages
kamleshapUser is Offline

Posts:26

12/14/2005 9:43 AM  
Const LOGOFF = 0Const SHUTDOWN = 1Const REBOOT = 2Const FORCE = 4Const POWEROFF = 8For Each objPC In GetObject("winmgmts:{(shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
objPC.Win32Shutdown LOGOFF + FORCENext
On 12/15/05, Darren Mar-Elia wrote:



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@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
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@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
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@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
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.
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"Be the change you want to see in the World"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aricbernardUser is Offline

Posts:2

12/14/2005 10:25 AM  
Unfortunately the addition of the force
flag does not resolve this issue.



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Kamlesh Parmar
Sent: Wednesday, December 14, 2005
12:47 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: Re: [ActiveDir]
Win32Shutdown Method & Win2003



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
wrote:

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.



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Be the change you want to see in the World"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dhardingUser is Offline

Posts:24

12/14/2005 10:44 AM  
Force (4) also gives the same result. 
Generic Error. And does not log off the user.



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Kamlesh Parmar
Sent: Wednesday, December 14, 2005
3:47 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: Re: [ActiveDir]
Win32Shutdown Method & Win2003



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 darren.marelia@xxxxxxxxx> wrote:

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.



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Be the change you want to see in the World"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
darren.marelia@xxxx.yyy

12/14/2005 11:04 AM  
I think this has to do with the APIs that are used by
WMI to initiate the Shutdown, and the
special nature of TS sessions. The
ExitWindowEX API, which I suspect WMI is calling under the covers, since it
takes the same parameters as that function, only works for console sessions.
However, TS sessions are special sessions and so aren't properly identified to
that API. I took a quick look at the WMI provider for Terminal Server but as far
as I can see all of the classes and methods there are meant for managing TS from
the server side rather than the client. There is a Win32 API called
WTSLogoffSession but you would have to write a utility to call it, which I think
you were trying to avoid. In any case, its documented here: http://msdn.microsoft.com/library/default.asp?url="">

It seems like there
should be an easy way to do this but as of yet, I haven't found
it.

Darren
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 12:36 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
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-EliaSent: Wednesday,
December 14, 2005 2:16 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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, 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.
AD00000645User is Offline

Posts:0

12/14/2005 12:39 PM  
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/15/2005 3:33 AM  
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: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Wednesday, December 14, 2005 2:13 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
Force (4) also gives
the same result.  Generic Error. And does not log off the
user.



From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Kamlesh
ParmarSent: Wednesday,
December 14, 2005 3:47 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: Re: [ActiveDir] Win32Shutdown
Method & Win2003

YUP,  you
should add 4, Here is some codeConst 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 darren.marelia@xxxxxxxxx>
wrote:
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
AM

To: 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.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"Be the change you want to see in the
World"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dhardingUser is Offline

Posts:24

12/15/2005 4:19 AM  
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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Alain Lissoir
Sent: Wednesday, December 14, 2005
10:30 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: RE: [ActiveDir]
Win32Shutdown Method & Win2003



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

Force (4) also gives the
same result.  Generic Error. And does not log off the user.





From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Kamlesh Parmar
Sent: Wednesday, December 14, 2005
3:47 PM
To: ActiveDir@xxxxxxxxxxxxxxxxxx
Subject: Re: [ActiveDir]
Win32Shutdown Method & Win2003



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 darren.marelia@xxxxxxxxx> wrote:

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.



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Be the change you want to see in the World"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alainlissoirUser is Offline

Posts:3

12/15/2005 4:58 AM  
Shutdown.Exe
-l -t 0

But I'm sure
that many other people have many other good tool to
suggest.
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Thursday, December 15, 2005 8:15 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: 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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Alain
LissoirSent: Wednesday,
December 14, 2005 10:30 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003


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:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Harding, DevonSent: Wednesday, December 14, 2005 2:13
PMTo: ActiveDir@xxxxxxxxxxxxxxxxxxSubject: RE: [ActiveDir] Win32Shutdown
Method & Win2003
Force (4)
also gives the same result.  Generic Error. And does not log off the
user.


From:
ActiveDir-owner@xxxxxxxxxxxxxxxxxx [mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx]
On Behalf Of Kamlesh
ParmarSent: Wednesday,
December 14, 2005 3:47 PMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: Re: [ActiveDir] Win32Shutdown
Method & Win2003

YUP,  you
should add 4, Here is some codeConst 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 darren.marelia@xxxxxxxxx>
wrote:
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
AM

To: 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.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"Be the change you want to see in the
World"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You are not authorized to post a reply.
Page 2 of 2<< < 12

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:1
User CountOverall:4264

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

Online NowOnline Now:

Ads

Copyright 2008 ActiveDir.org
Terms Of Use