8,330 questions
Hi @chirag darji ,
the variable $applist
isn't set/defined in your script. For that reason the value of the variable is always empty.
Please try this, after you fixed the $applist
variable:
Clear-Host
$Error.Clear()
$apps = @()
$appname = Get-Content -Path .\applist.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
$sysapp = $INSTALLED | Where-Object { $_.DisplayName -ne $null }
foreach ($a in $sysapp) {
$b = $a.DisplayName
if ($b -in $appname) {
$apps += [PSCustomObject]@{SystemApps = $a.DisplayName; ReuirApps = $applist }
}
else {
$apps += [PSCustomObject]@{SystemApps = $a.DisplayName; ReuirApps = $applist }
}
#$output += $apps
}
return $apps
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten