Thursday, May 5, 2016

Use of NULL


$null is available to represent nothing.  You can use this if you need to check for nothing, or indeed, "not nothing" i.e. something.  This command is an example of its use.  In this case it only returns items where the ExcludeFileList value in not blank or null.

Get-WmiObject -Namespace ROOT\ccm\SoftMgmtAgent -Class CacheInfoEx | where {$_.excludefilelist -notlike $null}