Skip to content

Instantly share code, notes, and snippets.

@rheid
Created February 8, 2016 20:42
Show Gist options
  • Save rheid/a0a4690f119104d0758b to your computer and use it in GitHub Desktop.
Save rheid/a0a4690f119104d0758b to your computer and use it in GitHub Desktop.
PowerShell script to display version info for installed SharePoint product and language packs
# PowerShell script to display SharePoint products from the registry.
Param(
# decide on whether all the sub-components belonging to the product should be shown as well
[switch]$ShowComponents
)
# location in registry to get info about installed software
$RegLoc = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
# Get SharePoint Products and language packs
write-host "Products and Language Packs"
write-host "-------------------------------------------"
$Programs = $RegLoc |
where-object { $_.PsPath -like "*\Office*" } |
foreach {Get-ItemProperty $_.PsPath}
$Components = $RegLoc |
where-object { $_.PsPath -like "*1000-0000000FF1CE}" } |
foreach {Get-ItemProperty $_.PsPath}
# output either just the info about Products and Language Packs
# or also for sub components
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment