Tuesday, 19 September 2017

SCCM Application Detection Method Advanced Query (Search SDMPackageDigest.XML)


SCCM Application Detection Method Advanced Query 
(Search SDMPackageDigest.XML)

I recently needed to re-sign all PowerShell Scripts in our environment because our Code Signing Certificate was about to expire.
Applications and Packages Content re-signing was straight forward by using PowerShell to Look for PS1 files, re-sign, and re-distribute to SCCM DPs.
(Using Start-CMContentDistribution)

However I needed to look at the Detection Methods being used and Global Conditions.
The creation of this script saved me hours, and manually without a doubt I would of missed some Applications.

Change this line to like '%.VBS%'  or your criteria.
and CONVERT(varchar(max), DeploymentTypes.SDMPackageDigest) like '%.ps1%'
Un-comment the line below to search for MSI Installs or Script, App-v Etc.
--and Technology = 'script'

/*     .NOTES
===========================================================================
        Created on:         28th August 2017
        Created by:         Matthew Swanston
        Contact             http://thebeardysccmguy.blogspot.com
        Filename:           DetectionMethods
===========================================================================
       .DESCRIPTION
              Provides a search ability for SCCM Application Detection methods
              .e.g Searching for a Powershell DetectionMethod or VBS etc.
              Or Searching for Deployment Technology type E.g. Script or MSI
              DisplayName   DateLastModified       CreatedBy     Description   Technology    SDMPackageVersion       SDMPackageDigest
*/
SELECT        Apps.DisplayName
                      ,Apps.DateLastModified
                      ,Apps.CreatedBy
                      ,Apps.Description
                      ,Technology
                      ,Apps.SDMPackageVersion
                     ,DeploymentTypes.SDMPackageDigest
FROM         dbo.fn_ListDeploymentTypeCIs(1033) AS DeploymentTypes
INNER JOIN dbo.fn_ListLatestApplicationCIs(1033) AS Apps ON DeploymentTypes.AppModelName = Apps.ModelName
WHERE     (DeploymentTypes.IsLatest = 1)
and CONVERT(varchar(max), DeploymentTypes.SDMPackageDigest) like '%.ps1%'
--and Technology = 'script'
order by Apps.DisplayName



No comments:

Post a Comment