Windows Server

PowerShell Script to List Installed Software

Open PowerShell and copy paste the below command:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

The above script will provide you a list of all your programs, complete with the version, name of the developer, and even the date you installed it. Check the below screen-shot.

In order to export this list check below command:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\Users\cc\Documents\InstalledPrograms-PS.txt

This will export the list of installed software in text format. Check below screen-shot. Also remember to change the path accordingly.

Else, check this for more information and large environment

Import-Module Activedirectory
Function Get-Soft ($Regpath,$PC){
Try {
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::'LocalMachine', $PC)

#connect to the needed key :

$regKey = $reg.OpenSubKey($Regpath)

#and list the properties :

$programs = $regkey.GetSubKeyNames()
foreach ($program in $programs)
{
$Soft = ($regKey.OpenSubKey($program)).GetValue("DisplayName") $Version = ($regKey.OpenSubKey($program)).GetValue("DisplayVersion") If ($Soft -notmatch "Update" -and $Soft -ne $null){
New-Object PSObject -Property @{ ComputerName = $PC DisplayName = $Soft Version = $Version
}
}
}
}
Catch [Exception]{ Write-Host "Collecting information from Computer $PC - Error : $($_.Exception.Message)" -ForegroundColor Red
}
}
$array = Get-ADComputer -Filter * -SearchBase "OU=Comp,DC=Domain,DC=com" | % {
$PC = $_.Name Write-Host "Collecting information from Computer $PC" -ForegroundColor Blue

"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\",` "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" | % { Get-Soft $_ $PC
}
}| Select ComputerName,Version,DisplayName -Unique

$array | ? {$_.DisplayName} | Select ComputerName,DisplayName,Version | Export-Csv C:\temp\Softwarelist.csv -NTI
$array | ? {$_.DisplayName} | Group DisplayName,Version -NoElement | Select Name,Count | Export-Csv C:\temp\SoftwareCount.csv -NTI

Checking Domain Computers for Specific Software Installed

Here we simply query the registry.

Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where{$_.DisplayName -eq "EXPSOFT"} | Select @{Label=ComputerName;e={$env:computername}},DisplayName,DisplayVersion | Export-CSV \\Path\File.csv -NoType -Append

You can check this one too for the same:

$InstalledSoftware = Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where{$_.DisplayName -eq "EXPSOFT"} New-Object PSObject -Property @{ ComputerName = $env:computername SoftwareName = $InstalledSoftware.DisplayName SoftwareVersion = $InstalledSoftware.Version } | Export-CSV \\Path\File.csv -NoType -Append

Both the above command will list out computer name, software name, and version. Also this will let you know which system have installed it or not.

Get list of software installed from a remote computer

We can try WMIC command to generate list.

wmic /user:”Domain\Admin” /password:”UsersPassword” /node:”RemoteHostname” product get name,version,vendor /format:csv > C:\SoftwareInstalled.csv

To above command will return all the software installed by msi package in a CSV file format.

Check for PowerShell remoting enabled.

Leave a Reply

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