Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Function to list packages installed in a Sitecore instance.
<#
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