:::: MENU ::::

Get Add remove program entries from local or remote machines using Powershell in a CSV format

Get Add remove program entries from local or remote machines using Powershell in a CSV format-

function Get-Uninstall
{
param([parameter(Mandatory = $true)]$computer)
# paths: x86 and x64 registry keys are different

Start-Process "C:\windows\system32\sc.exe" -ArgumentList "\\$computer start winrm"

Invoke-Command -ComputerName $computer -ScriptBlock {
if ([IntPtr]::Size -eq 4) {
$path = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
}
else {
$path = @(
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
}
# get all data
Get-ItemProperty $path |
# use only with name and unistall information
.{process{ if ($_.DisplayName -and $_.UninstallString) { $_ } }} |
# select more or less common subset of properties
Select-Object DisplayName, Publisher, InstallDate, DisplayVersion, HelpLink, UninstallString |
# and finally sort by name
Sort-Object DisplayName
}

Start-Process "C:\windows\system32\sc.exe" -ArgumentList "\\$computer stop winrm"
}

Get-Uninstall | Export-Csv -LiteralPath "$env:HOMEDRIVE\temp\ARP_Details.csv"-Force -NoTypeInformation


So, what do you think ?