Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Matching Appname and version in registry

$
0
0

I am trying to search for app displayname and version and if matches write the output but not sure why it is not working as expected. Can someone pls guide me. DisplayName and version will be passed to the script as param. It will search registry in two (32/64) hives and provide output. 

$appver = "1.2.3.4"
$appname = "App Name"

If ((Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse | Get-ItemProperty | where {$_ -eq $appver}) -and

(Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall -Recurse | Get-ItemProperty | where {$_ -eq $appname}))


{Write-Host "Installed"}


ElseIf ((Get-ChildItem -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse | Get-ItemProperty | where {$_ -eq $appver}) -and

(Get-ChildItem -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall -Recurse | Get-ItemProperty | where {$_ -eq $appname}))


{Write-Host "Installed"}


Else

{Write-Host "Not Installed"}

Thank you!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>