MEMCM Package MIF Matching

If you are familiar with the work that Gary Blok and I have done on BIOS and Drivers, you will already know that we like to use extra fields on the Package properties to store meta date that we use for reporting and automation. Four of the fields that we like to use are on the Reporting tab of the Package Properties:

These fields have been around forever in the product and are used to provide enhanced status information about the success of the deployment (meaning that they really need to match if this option is enabled). Since we are just ‘borrowing’ these fields, we want this option to remain set on “Use package properties for status MIF matching”. I was recently working on a script that did package promotion and syncing of these properties and was curious about being able to programmatically configure this setting to ensure it stayed set to the desired state. Looking at both the New-CMPackage cmdlet and the Set-CMPackage cmdlet, I found no such parameter that allows for this configuration (at least directly).

I decided to ping Gary and asked him if he had discovered a way to configure this setting, but his response was “Not that I know of, I would just make sure it was set properly on the package”. This meant that it was time to fire up WMIExplorer and see if I could find a hidden setting that controlled this property. With the property set to “Use package properties for status MIF matching”, I noticed that the PkgFlags were set to 16777216:

Changing the setting in the UI to “Use these fields for status MIF matching”, the PkgFlags value changed to 553648128:

Ok, this meant it was time to fire up the handy documentation and figure out what these values actually mean. This is in the SMS_PackageBaseclass Class and there is a nice definition of the properties that are controlled by PkgFlags. 0x20000000 looks like the one that we want to check for:

Using a little bit of PowerShell, we can get the PkgFlags value, check to see if it is enabled, and then correct it:

$x = Get-CMPackage -Id PS1000C8 -Fast
 if ($x.pkgflags -eq ($x.pkgflags -bor 0x20000000)) {
    Write-Output "MIF field matching enabled"
    Write-Output "Setting it back to use package properties"
    $x.PkgFlags = $x.pkgflags - 0x20000000
    $x.Put()
    }
 else {
    Write-Output "Use package properties for status MIF matching already set"
    }

Originally posted on https://miketerrill.net/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.