PowerShell to Search Registry

The following bit of PowerShell code will search the registry for a string. Update $Filter with the string you are searching for and the registry path with the path you are searching. I used this code to determine whether or not SCCM installed an application on my workstation.

$Filter = "SIT00001"  
dir "HKLM:\SOFTWARE\Wow6432Node\Microsoft\SMS\Mobile Client\Software Distribution\" -rec -ea SilentlyContinue |    
                 ForEach-Object {   
                 if ($_.PsPath.ToLower().Contains($Filter.ToLower())) {
                          Write-Host "True"
                 }
         } 

Leave a Reply