Short VBS code - get a single specified instance of ds_group class or get
a default unnamed instance (singleton) of the class, using one single command GetObject
with exact path of the wmi object.
Dim wmiObject
Set wmiObject = GetObject( _
"WINMGMTS:\\.\ROOT\directory\LDAP:" + _
"ds_group.ADSIPath=""LDAP://CN=WinRMRemoteWMIUsers__,CN=Users,DC=rootdomain,DC=com""")
Wscript.Echo wmiObject.ADSIPath
Get a specified instance of ds_group by a key, get a default unnamed instance (singleton) of the class or list instances of the class by wmi query using this c# sample code.
ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\directory\\LDAP");
ObjectQuery query = new ObjectQuery("SELECT * FROM ds_group Where ADSIPath=\"LDAP://CN=WinRMRemoteWMIUsers__,CN=Users,DC=rootdomain,DC=com\"");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
Console.WriteLine("ADSIPath : {0}", m["ADSIPath"]);
}
Get a specified instance of ds_group by a key, get a default unnamed instance (singleton) of the class or list instances of the class by wmi query using this VB.Net sample code.
Dim Scope As New ManagementScope("\\.\ROOT\directory\LDAP")
Dim Query As New ObjectQuery("SELECT * FROM ds_group Where ADSIPath="LDAP://CN=WinRMRemoteWMIUsers__,CN=Users,DC=rootdomain,DC=com"")
Dim Searcher As New ManagementObjectSearcher(Scope, Query)
Dim queryCollection As ManagementObjectCollection = Searcher.Get
For Each mObject As ManagementObject In queryCollection
Console.WriteLine("ADSIPath : {0}", mObject("ADSIPath"))
Next