Last active
December 19, 2015 00:49
-
-
Save lazywinadmin/5871476 to your computer and use it in GitHub Desktop.
Get-WmiObject Without Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In the module we have the following query | |
# (I had Backtick to fit in my blog, don't do this at home! ;-) ) | |
$computer = Get-WMIObject ` | |
-ComputerName $siteProvider ` | |
-Namespace "root\sms\site_$siteCode" ` | |
-Class "SMS_R_System" | Where { $_.ResourceID -eq $resourceId } | |
# Let's measure our command on a big environment (+6000 computers) | |
# 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>" ` | |
-Class "SMS_R_System" | where-object { $_.ResourceID -eq <ResourceID> }} | |
Days : 0 | |
Hours : 0 | |
Minutes : 0 | |
Seconds : 42 | |
Milliseconds : 273 | |
Ticks : 422735527 | |
TotalDays : 0.000489277230324074 | |
TotalHours : 0.0117426535277778 | |
TotalMinutes : 0.704559211666667 | |
TotalSeconds : 42.2735527 | |
TotalMilliseconds : 42273.5527 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment