I started working with an existing ConfigMgr environment where a number of Application, Package, and Task Sequence icons were already configured.  Some of them were high quality and looked great while others needed updating.  I wanted to reuse existing icons were possible, but the the icon source files were not stored along side the App or Pkg content source, nor in a centralized file share, etc.

I stumbled on to the fantastic blog post Export Icons From ConfigMgr Database by Émile Cabo which had some great code for extracting icons as PNG files from the database.

I made a bunch of updates including adding support for Packages and Task Sequences.

Get the full script and latest version on GitHub.

The core of the changes are in the SQL query you see here.

$sqlCommandText = "SELECT Distinct(Icon), 'App' [Type], Trim(' ' From (Publisher + ' ' + Title + ' ' + Version)) [ObjectFullName], Cast(CI_ID as varchar) [ContentID]
FROM CI_LocalizedCIClientProperties where Icon is not null
SELECT Distinct(P.Icon), 'Pkg' [Type], Trim(' ' FROM (P.Manufacturer + ' ' + P.Name + ' ' + P.Version)) [ObjectFullName], PkgID [ContentID]
FROM SMSPackages_G P inner join v_Package T on P.PkgId = T.PackageID where P.Icon is not null and P.PkgId NOT IN (Select PackageID from v_TaskSequencePackage)
SELECT Distinct(P.Icon), 'TS' [Type], P.Name [ObjectFullName], PkgID [ContentID]
FROM SMSPackages_G P inner join v_TaskSequencePackage T on P.PkgId = T.PackageID where P.Icon is not null
order by ContentID"
Export icons from ConfigMgr
Tagged on: