This post is to list all the software installed on your local or remote machines. The exclusion list is an array item which holds the programs that you wanted to exclude it from displaying.
********************************************************************************
Function Get-SoftwareList {
param(
[CmdletBinding()]
[string[]]$ComputerName = $env:COMPUTERNAME
)
$writeArray=@()
$excludeArray=@()
#List of programs to exclude
$excludeArray = (“Security Update for Windows”,
“Update for Windows”,
“Update for Microsoft .NET”,
“Security Update for Microsoft”,
“Hotfix for Windows”,
“Hotfix for Microsoft .NET Framework”,
“Hotfix for Microsoft Visual Studio 2007 Tools”,
“Hotfix”)
foreach ($Computer in $ComputerName) {
$RegBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Computer)
$RegUninstall = $RegBase.OpenSubKey(‘SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall’)
$RegUninstall.GetSubKeyNames() |
ForEach-Object {
$DisplayName = ($RegBase.OpenSubKey(“SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$_”)).GetValue(‘DisplayName’)
$donotwrite = $false
if (($DisplayName -ne “”) -and ($DisplayName -ne $null)) {
Foreach($exclude in $excludeArray)
{
if($DisplayName.StartsWith($exclude) -eq $TRUE)
{
$donotwrite = $true
break
}
}
if ($donotwrite -eq $false)
{
$writeArray +=New-Object -TypeName PSCustomObject -Property @{
ComputerName = $Computer
ProgramName = $DisplayName }
}
}
}
}
$column1 = @{expression=”ComputerName”; width=12; label=”ComputerName”; alignment=”left”}
$column2 = @{expression=”ProgramName”; width=120; label=”ProgramName”; alignment=”left”}
$writeArray|format-table $column1, $column2
$writeArray.GetEnumerator() | Out-GridView -Title “Software List”
}
********************************************************************************
Download here SoftwareList
Example 1 – Local Machine
PS:\>Get-SoftwareList
Example 2 -Remote computer
PS:\>Get-SoftwareList -ComputerName <COMPUTERNAME>
Example 3- Remote Computers
PS:\>Get-SoftwareList -ComputerName <COMPUTERNAME1,COMPUTERNAME2….>
Output -