Skip to content

Instantly share code, notes, and snippets.

@lazywinadmin
Last active December 19, 2015 00:49
Show Gist options
  • Save lazywinadmin/5871509 to your computer and use it in GitHub Desktop.
Save lazywinadmin/5871509 to your computer and use it in GitHub Desktop.
Get-WmiObject with Filtering
# Let's measure our command on a big environment (+6000 computers) with some filtering
# Note that I replaced some values, you need to specify the SiteProvider, SiteCode and
# ResourceID.
Measure-Command {Get-WMIObject`
-ComputerName <SiteProvider> `
-Namespace "root\sms\site_<SITECODE>" `
-Query "Select * From SMS_R_System WHERE ResourceID='<ResourceID>'"}
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 202
Ticks : 2026858
TotalDays : 2.34590046296296E-06
TotalHours : 5.63016111111111E-05
TotalMinutes : 0.00337809666666667
TotalSeconds : 0.2026858
TotalMilliseconds : 202.6858
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment