Last active
August 29, 2015 14:23
-
-
Save michaellwest/7ebfa0d8bfe6ba540028 to your computer and use it in GitHub Desktop.
Function to list packages installed in a Sitecore instance.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Adapted from the Package History module found here: | |
https://marketplace.sitecore.net/en/Modules/PackageHistory.aspx | |
#> | |
function Get-PackageHistory { | |
$packageHistoryPath = "/sitecore/system/Packages/Installation history" | |
$packageRegistrationTemplateId = "{22A11D20-5F1D-4216-BF3F-18C016F1F98E}" | |
$coreDb = Get-Database -Name "core" | |
$historyItem = $coreDb.GetItem($packageHistoryPath) | |
if($historyItem) { | |
$props = @{ | |
Property = @( | |
"Name", "ID", | |
"Package Name", "Package Version", | |
"Package Author", "Package Publisher", | |
"Package ReadMe", "Package Revision", | |
"Package ID" | |
) | |
} | |
foreach($installItem in $historyItem.Axes.GetDescendants()) { | |
if($installItem.Template.ID -eq $packageRegistrationTemplateId) { | |
Get-Item core:\ -id $installItem.ID | Select-Object @props | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment