Worklet: Installed vs Approved software list

This worklet compares a list of currently installed software to a list of approved software. The worklet uses .txt files to store the arrays since that made it easier to test. The Approved.txt file needs to be uploaded to the worklet, and should just be a list of approved software, one per line. Wildcards can be used in the Approved.txt file.

Exit 1


Get-WmiObject -Class Win32_Product | Sort-Object -Property Name | Select -ExpandProperty Name | Set-Content Installed.txt
$Installed = Get-Content Installed.txt
$Approved = Get-Content Approved.txt
Write-Host "Unapproved Software:"
$Installed |Where {$item=$_; -not ($Approved |Where {$item -like $_}) }