Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to get all the values of User Rights Assignment in Local Computer Setting using VBScript and WMI. Is there a way I can do this with VBScript and WMI?

Thanks.

share|improve this question
1  
It's buried somewhere within the root\rsop\computer WMI namespace, I just know it, but I've been working on this for a couple hours and I have yet to arrive at a silver bullet solution. :( –  Ryan Ries Jan 3 '13 at 2:58

2 Answers 2

Hopefully this is what you're looking for: http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/computermanagement/policy/#EnumPolUserPrivs.htm

share|improve this answer
    
    
I think so when the link takes you to information that directly solves the user's question. The code needed no modification and I felt it redundant to copy/paste when we could all take advantage of a "hyperlink". –  Jay Adams Jan 18 '13 at 3:53
    
You may consider following my comment's link. It will provide you some of the StackExchange community's discussion on this topic. –  jscott Jan 18 '13 at 11:02

Here is an example of how I did in C# .NET based on Jay Adams link and the RSOP_UserPrivilegeRight class documentation, I guess this is easily portable to VBS:

using System.Management;    

ManagementScope scope = new ManagementScope(@"\\localhost\root\rsop\computer");
ObjectQuery query = new ObjectQuery("SELECT * FROM RSOP_UserPrivilegeRight");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

scope.Connect();

ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
    Console.WriteLine("=> User right: {0}, precedence: {1}", m["UserRight"], m["precedence"]);

    Action<string> action = new Action<string>(Console.WriteLine);
    Array.ForEach((string[])m["AccountList"], action);
 }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.