Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

c# WMI Select * from RSOP_GPO

$
0
0

Hi there,

I am trying to get a list of group policy objects applied to a computer. See code below. I get a list of policies but they differ from the RSOP on the actual computer. I need to know how to filter it so that it only lists the policies that are applied.

ManagementScope scope = new ManagementScope(String.Format("\\\\{0}\\root\\RSOP\\Computer", strComputer));
scope.Connect();
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new ObjectQuery("Select * from RSOP_GPO"));
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    if (!(bool)queryObj.GetPropertyValue("AccessDenied"))
                    {
                        cbGSIPA.Items.Add((string)queryObj.GetPropertyValue("Name"));
                    }
                }


Thanks, Garth.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>