Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellwest/7ebfa0d8bfe6ba540028 to your computer and use it in GitHub Desktop.
Save michaellwest/7ebfa0d8bfe6ba540028 to your computer and use it in GitHub Desktop.
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