Created
October 7, 2022 02:15
-
-
Save w0ltage/a00c716df9f1210c1ea9862aa5b6efc1 to your computer and use it in GitHub Desktop.
PowerShell - Check if the application is installed. If it is installed, write the name, vendor (publisher), version, and path to the file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$software = Read-Host -Prompt 'Enter an application name: '; | |
$uninstallInfo = gp HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | |
$applicationName = $uninstallInfo.DisplayName -Match $software | |
If ($applicationName) { | |
$anchor = [regex]::Match($uninstallInfo.PSPath -Match $software,'.*\\(.*)').captures.groups[1].value | |
$applicationInfo = gp HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$anchor | |
$vendor = $applicationInfo.Publisher | |
$version = $applicationInfo.DisplayVersion | |
$path = $applicationInfo.DisplayIcon | |
Write-Host "$applicationName is installed. Writing more info in .\$software.txt" | |
Out-File -File .\$software.txt -InputObject "'$applicationName' with verstion '$version' from '$vendor' is installed in '$path'" | |
} else { | |
Write-Host "'$software' NOT installed."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment