function Get-InstalledSoftwares
{
function ConvertTo-ProductEntity
{
param([Microsoft.Win32.RegistryKey]$RegKey)
$product = '' | select Name,Publisher,Version
$product.Name = $_.GetValue("DisplayName")
$product.Publisher = $_.GetValue("Publisher")
$product.Version = $_.GetValue("DisplayVersion")
if( -not [string]::IsNullOrEmpty($product.Name)){
$product
}
}
$UninstallPaths = @(,
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall')
if([Environment]::Is64BitOperatingSystem) {
$UninstallPaths += 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
}
$UninstallPaths | foreach {
Get-ChildItem $_ | foreach {
ConvertTo-ProductEntity -RegKey $_
}
}
}