Well, there are no instances under RSOP\User. All the instances are under the SID of the particular user. So for example you would need to connect to RSOP\User\<SID>
I am attempting to determine policy settings on my local PC. I can get the 'Computer' settings by doing the following (using C#):
ManagementScope ms = new ManagementScope("\\root\\RSOP\\Computer");
ObjectQuery oq = new ObjectQuery("SELECT * FROM RSOP_RegistryPolicySetting");
ManagementObjectSearcher mos = new ManagementObjectSearcher(ms, oq);
ManagementObjectCollection moc = mos.Get();
This gives me a nice long list of policies. However, if I attempt to get the user policies ("\\root\\RSOP\\User" as the path), I get nothing returned. No errors, just no results. Anyone have any suggestions? I have also tries selecting from RSOP_PolicySetting and get the same type of result.
Well, there are no instances under RSOP\User. All the instances are under the SID of the particular user. So for example you would need to connect to RSOP\User\<SID>
Thanks for the reply. What format should the SID take? I tried the typical S-1-5-21-... and all I get is a 'Invalid parameter' error.
Yes, standard SID string form. You of course need to make sure that the SID exists in WMI. I use WMIX as a WMI browser. Great tool.
Again, thanks for the reply. However, I still just get 'Invalid parameter'.
Here is the code snippet:
ManagementScope ms = new ManagementScope("\\root\\RSOP\\User\\S-1-5-21-dddddddd-dddddddddd-dddddddd-dddd");
ObjectQuery oq = new ObjectQuery("SELECT * FROM RSOP_RegistryPolicySetting");
ManagementObjectSearcher mos = new ManagementObjectSearcher(ms, oq);
ManagementObjectCollection moc = mos.Get();
I don't want to go publishing my SID, but I check it in several places, including WMI, LDAP and WIN32, so I know it is the correct SID.
By the way, I use WinXP Professional with SP2 and I am an Administrator of my PC.
I discovered what the problem is:
The SID needs to be specified with '_' (underscores) instead of '-' (dashes).
Again, thanks for your help.
Yes, sorry-- I didn't even notice that when I was looking at WMI!