Wql Query Domain Name. Replace the OU Name in the example with the name of the OU that we want to query for. WHERE nameiexploreexe The WMI query to execute.
I thought it might be useful to share out a few of my most commonly used queries. Many of these tasks are best performed with ADSI scripts. Select from Win32_ComputerSystem where domain like domain name.
Replace domainlocalOUOU with your own domain name and OU that you need a collection of.
Get-WmiObject -Namespace rootcimv2 -Query SELECT Caption SessionId FROM Win32_Process WHERE Caption wmiprvseexe OR Caption iexploreexe In the example above the returned properties are not only Caption and SessionId there are many properties that are returned by the object. Doing this for multiple domain names over time can help you build a list of available domain names. For more information and other examples see the TechNet ScriptCenter Script Repository. Replace domainlocalWorkstations with your own domain name and OU that you need a collection of.