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?


  • 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

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);


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);

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

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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