Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can use the Get-WMIObject cmdlet on a local host to perform a WMI query.
For example:
Get-WmiObject -query "Select PartialProductKey,Description from SoftwareLicensingProduct where productkeyid is not null"
But how do you query a remote machine? By using PowerShell with the WMISearcher!
Here's an example of how to perform a WMI query against a remote machine called DexterDC:
$hostname = "DexterDC"
$searcher = [wmisearcher]"Select ClientMachineID,RemainingWindowsReArmCount from SoftwareLicensingService"
$searcher.scope.path = "\\$Hostname\root\cimv2"
$searcher.get()
References
- Link to the Question asked on Technet Forum which made me discover this.