Solved

WMI Privileges

Posted on 2004-04-29
7
950 Views
Last Modified: 2013-12-03
Hi,
my domain users have policies to run logon logoff vbs script. I must denied logon for some users.
This is the code:
......
For Each os In GetObject("winmgmts:{impersonationLevel=impersonate,(shutdown,remoteshutdown)}!//" +        
                objNet.Computername).InstancesOf("Win32_OperatingSystem")
         retCode = os.Win32Shutdown(4, 0)
Next
......
objNet.Computername is the PC to shutdown.

When the administrator runs the code, the pc shutdown normally. Any other user get this error message:

Code 80041062, privilege not available. (iswbemobject)

The error is on the line retCode = os.Win32Shutdown(4, 0)

With DCOMCNFG everything seems OK for the application Windows Management Instrumentation.

Any suggestion?

Thank you
0
Comment
Question by:Meronic
  • 3
  • 2
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 10950328
Are you sure that the 'Shutdown computer' privilege is granted to these users?
0
 

Author Comment

by:Meronic
ID: 10950640
I'm sorry; not shutdown computer but logoff; Users does not have privilege to shutdown computer and I don't want to assign them the right.


os.Win32Shutdown(4, 0)
4 means logoff, right??


Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 10950799
See http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32shutdown_method_in_class_win32_operatingsystem.asp ("Win32Shutdown Method of the Win32_OperatingSystem Class") - it clearly states that "On computer systems running Windows® NT/Windows 2000, the calling process must have the SE_SHUTDOWN_NAME privilege", regardless of what the parameters are...
0
 

Author Comment

by:Meronic
ID: 10951478
How can I verify the process privilege?
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 10951971
I am not too familiar with WMI, but http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_privilegesstatus.asp ("Win32_PrivilegesStatus") should help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now