Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Last active October 3, 2018 17:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaellwest/399be5c7817681f8791bc1676bdaeb5f to your computer and use it in GitHub Desktop.
Save michaellwest/399be5c7817681f8791bc1676bdaeb5f to your computer and use it in GitHub Desktop.
Update modules to use the new Sitecore PowerShell Extensions 5.0 icons.
<#
.SYNOPSIS
Sitecore PowerShell Extensions 5.0 uses new icons. This script is designed to update
your existing modules to use the new icon.
.DESCRIPTION
The SPE module changes the icon when you enable/disable the module. Only disabled modules
will automatically take the new icon. This is script helps by updating all of the icons
for enabled modules. Alternatively, you can go through and disable then enable the modules.
#>
$scriptRootId = "{A3572733-5062-43E9-A447-54698BC1C637}"
$moduleTemplateId = "{6D82FCD8-C379-443C-97A9-C6423C71E7D5}"
$oldEnabledIcon = "Software/32x32/jar_bean.png"
$newEnabledIcon = "Office/32x32/jar_coffee_bean.png"
$oldDisabledIcon = "Software/32x32/jar_delete.png"
$newDisabledIcon = "Office/32x32/jar.png"
$moduleItems = Get-ChildItem -Path "master:" -ID $scriptRootId -Recurse |
Where-Object { $_.TemplateID -eq $moduleTemplateId }
$moduleItems |
Where-Object { $_.Enabled -eq "1" -and $_."__Icon" -eq $oldEnabledIcon } |
ForEach-Object { $_."__Icon" = $newEnabledIcon }
$moduleItems |
Where-Object { $_.Enabled -ne "1" -and $_."__Icon" -eq $oldDisabledIcon } |
ForEach-Object { $_."__Icon" = $newDisabledIcon }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment