3

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.

1
  • 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, 2013 at 2:58

2 Answers 2

1

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

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

3
  • 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, 2013 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, 2013 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .