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.

Hendri
  • 31
  • 1
  • 2
  • 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 03 '13 at 02:58

2 Answers2

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);
 }
gyzpunk
  • 111
  • 1
0

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

Jay Adams
  • 306
  • 1
  • 5
  • [Are answers that just contain links elsewhere really “good answers”?](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers) – jscott Jan 17 '13 at 02:59
  • 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 03: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