Param(
[switch]$ShowComponents
)
$RegLoc = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
$Programs = $RegLoc |
where-object { $_.PsPath -like "*\Office*" } |
foreach {Get-ItemProperty $_.PsPath}
$Components = $RegLoc |
where-object { $_.PsPath -like "*1000-0000000FF1CE}" } |
foreach {Get-ItemProperty $_.PsPath}
if ($ShowComponents.IsPresent)
{
$Programs | foreach {
$_ | fl DisplayName, DisplayVersion;
$productCodes = $_.ProductCodes;
$Comp = @() + ($Components |
where-object { $_.PSChildName -in $productCodes } |
foreach {Get-ItemProperty $_.PsPath});
$Comp | Sort-Object DisplayName | ft DisplayName, DisplayVersion -Autosize
}
}
else
{
$Programs | fl DisplayName, DisplayVersion
}
[switch]$ShowComponents
)
$RegLoc = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
$Programs = $RegLoc |
where-object { $_.PsPath -like "*\Office*" } |
foreach {Get-ItemProperty $_.PsPath}
$Components = $RegLoc |
where-object { $_.PsPath -like "*1000-0000000FF1CE}" } |
foreach {Get-ItemProperty $_.PsPath}
if ($ShowComponents.IsPresent)
{
$Programs | foreach {
$_ | fl DisplayName, DisplayVersion;
$productCodes = $_.ProductCodes;
$Comp = @() + ($Components |
where-object { $_.PSChildName -in $productCodes } |
foreach {Get-ItemProperty $_.PsPath});
$Comp | Sort-Object DisplayName | ft DisplayName, DisplayVersion -Autosize
}
}
else
{
$Programs | fl DisplayName, DisplayVersion
}