In my script, I have match Installed computer program with my text file, If the installed program is match with my taxt file then showing same program name in Installed-App column, if it is not match displaying "Not Installed". I Want Hightlight "Not Installed" in RED color which is define in $apps = [PSCustomObject]@{RequirApp=$requirapp; $systemapp="Not Installed"}
. Can you help me out anyone. Hear is my code
$appname = Get-Content -path $env:USERPROFILE\Documents\Installed-Applications.txt
$INSTALLED = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate
$INSTALLED += Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate
$INSTALLED += Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate
#$INSTALLED | ?{$_.DisplayName -ne $null} | Select-Object -Property DisplayName | out-file $env:USERPROFILE\Documents\Installed-Applications.txt
$sysapps = $INSTALLED | ?{$_.DisplayName -ne $null}
for($i=0; $i -lt $sysapps.Count; $i++)
{
$installapp += $sysapps[$i].DisplayName
}
foreach($a in $appname)
{
$requirapp = $a
if($installapp -contains $requirapp.Trim())
{
$apps = [PSCustomObject]@{RequirApp=$requirapp; $systemapp=$requirapp}
}
else
{
$apps = [PSCustomObject]@{RequirApp=$requirapp; $systemapp="Not Installed"}
}
$apps
}