Get installed software on your machine

Today’s post will show how to get installed software on your machine.

In one of my previous articles I show you script for uninstall of application.
But what if you want only check when software was installed or how to uninstall it? This article for sure will help you!

Function which I prepared is checking registry for all profiles created on machine and get installed software by command Get-ItemProperty, which is searchinng for specific registry path.
As a result function will return follwing attributes:
– DisplayVersion
– DisplayName
– InstalledDate
– Size
– UninstallString

Example of usage:

Get-Software -DisplayName "Microsoft*"
Get-Software -Version "12.*"

Script:

function Get-Software
{
    param
    (
        [Parameter(Position=0, Mandatory = $false, HelpMessage="DisplayName", ValueFromPipeline = $true)]
        $DisplayName='*',
        [Parameter(Position=0, Mandatory = $false, HelpMessage="Version", ValueFromPipeline = $true)]
        $Version='*',
        [Parameter(Position=0, Mandatory = $false, HelpMessage="Installation date", ValueFromPipeline = $true)]
        $InstallationDate='*',
        [Parameter(Position=0, Mandatory = $false, HelpMessage="How to uninstall", ValueFromPipeline = $true)]
        $UninstallationPath='*'

    )
    
    $UninstallationPathAllProfiles = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
    $UninstallationPathCurrentPrfoile = "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
    $UninstallationPathAllProfilesWOW64 = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
    $UninstallationPathCurrentPrfoileWOW64 = "Registry::HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"

    $ResultArray = Get-ItemProperty -Path $UninstallationPathAllProfiles, $UninstallationPathCurrentPrfoile, $UninstallationPathAllProfilesWOW64, $UninstallationPathAllProfilesWOW64 | `
    Select-Object -Property DisplayVersion, DisplayName, InstallDate, @{Name="Size in MB";Expression={[Math]::Round($_.EstimatedSize / 1024)}} ,UninstallString
    $ResultArray | Where-Object {$_.DisplayName -ne $null -and $_.DisplayName -like $DisplayName -and $_.DisplayVersion -like $Version `
    -and $_.UninstallString -like $UninstallationPath -and $_.InstallDate -like $InstallationDate}
    
    return $ResultArray
}

In the result you should receive array like on screenshot below

I hope it will be usefull for some of you 😉
Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.