1.

Blog To Find Any Drivers or Software Packages Not Linked or Deployed Through SCCM Task Sequecnce

Loading

 

Author: Nawaz kazi

When you build a lab environment you often install lots of software and packages that are not needed to run the lab environment. Especially when you don’t track your lab for a period of time, it is easy to forget which packages are needed and which ones are not. Yesterday it did raise an alarm as i was running out of space. I’ve noticed that my lab environments did have drivers installed, fonts, and other software. This can be a waste of resources and unnecessary if this is not deployed or linked with any of your deployments.

In this blog, I’ll talk about the drivers and software packages that are not linked with task sequence and which can safely be removed and claimed space on disk.

Once again SQL query does the trick to retrieve data in one go. This query was good enough for my purposes. I also wanted to make sure that I am also getting the amount of size that is going to be freed up.

Query 1: To list software packages that are not part of the task sequence that is not deployed.
SELECT pkg.Name as [Package Name], 
pkg.Version, 
pkg.PkgID,
pkg.Source,(pkg.SourceSize)/(1024) as 'Size in MB', -- To list Size in MB.
CASE pkg.PackageType
WHEN 0 THEN 'Software Distribution Package'
WHEN 3 THEN 'Driver Package'
WHEN 4 THEN 'Task Sequence Package'
WHEN 5 THEN 'Software Update Package'
WHEN 6 THEN 'Device Settings Package'
WHEN 7 THEN 'Virtual Package'
WHEN 257 THEN 'Image Package'
WHEN 258 THEN 'Boot Image Package'
WHEN 259 THEN 'OS Install Package'
END AS [Package Type], adv.AdvertisementID, ts.Name as [TS Name]
FROM SMSPackages pkg
LEFT JOIN v_Advertisement adv on pkg.PkgID=adv.PackageID
LEFT JOIN v_TaskSequencePackageReferences tsr on pkg.PkgID=tsr.RefPackageID
LEFT JOIN v_TaskSequencePackage ts on tsr.PackageID=ts.PackageID
WHERE adv.AdvertisementID is null -- No deployment
AND ts.Name is null --- No Task sequecne is referenced
--and pkg.PackageType = @PackageType --To be used in rebport builder.
and pkg.PackageType =0 -- 0 Stands "for software Distribution Package" and 3 for "Driver Packages"
ORDER BY pkg.SourceSize desc
Output1.

 

To list Driver Packages that are not part of the task sequence
SELECT pkg.Name as [Package Name], 
pkg.Version, 
pkg.PkgID,
pkg.Source,(pkg.SourceSize)/(1024) as 'Size in MB', -- To list Size in MB.
CASE pkg.PackageType
WHEN 0 THEN 'Software Distribution Package'
WHEN 3 THEN 'Driver Package'
WHEN 4 THEN 'Task Sequence Package'
WHEN 5 THEN 'Software Update Package'
WHEN 6 THEN 'Device Settings Package'
WHEN 7 THEN 'Virtual Package'
WHEN 257 THEN 'Image Package'
WHEN 258 THEN 'Boot Image Package'
WHEN 259 THEN 'OS Install Package'
END AS [Package Type], adv.AdvertisementID, ts.Name as [TS Name]
FROM SMSPackages pkg
LEFT JOIN v_Advertisement adv on pkg.PkgID=adv.PackageID
LEFT JOIN v_TaskSequencePackageReferences tsr on pkg.PkgID=tsr.RefPackageID
LEFT JOIN v_TaskSequencePackage ts on tsr.PackageID=ts.PackageID
WHERE adv.AdvertisementID is null -- No deployment
AND ts.Name is null --- No Task sequecne is referenced
--and pkg.PackageType = @PackageType --To be used in rebport builder.
and pkg.PackageType =3 -- 3 for "Driver Packages"
ORDER BY pkg.SourceSize desc
Output:2

 

These outputs are ok to identify and fix, but I am also keen to publish this as a report so that all data can be retrieved from the sccm reporting portal. Download the report from my GitHub page.

In order to upload a report to your SCCM SSRS portal check out the report manager link t,  this report manager is quite helpful, created by Benoit Lecours [MVP]

once the report is uploaded you have found options to fetched details as required4

 

 

 

 

Output for driver Package.5

 

Feel free to comment with any suggestions/feedback.

4 thoughts on “Blog To Find Any Drivers or Software Packages Not Linked or Deployed Through SCCM Task Sequecnce”

Leave a Comment

Your email address will not be published. Required fields are marked *