How long does this script / WMI Filter take?

I was reading GP MVP Darren Mar-Elia’s forum about WMI Filters and discovered a sweet PowerShell trick from another awesome friend of the GP team, Thorbjörn Sjövold (CTO of Specops Software)

You can use the PowerShell cmdlet “measure-command” to measure the time it takes to run script blocks and cmdlets – this includes WMI filters! This came up in a thread about logon time.

Read the full thread here.

Here's how to set it up"...deploy a new environment variable, for example INSTALLADOBE using Group Policy Preferences. Use their Windows Installer Target and then use a WMI filter like this for the actual installation.

 SELECT * FROM Win32_Environment WHERE Name = 'INSTALLADOBE'

You can compare the two WMI queries like this using PowerShell to get an idea on how much faster it is:

measure-Command {Get-WmiObject -query "SELECT * FROM Win32_Environment WHERE Name = 'OS'"}

just substitute the OS name with the name of any Environment variable like INSTALLADOBE, but to test the speed it does not really matter. 

measure-command {Get-WmiObject -query "Select * from Win32_Product where Name like '%Adobe Reader%'"}

"

Thanks guys! Hope you find this useful,

@superlilia