I am working on a Powershell script that needs to change Configuration Item 
rules and cannot figure out how to make these changes. The documentation is not 
super helpful, but it appears the actual rules are stored as a big chunk of xml 
data (like the application definitions). It looks like I should be able to get 
the wmi object for the configuration item, deserialize the xml definition, make 
my changes, reserialize, and reinject the xml. Unfortunately, I cannot figure 
out how to reserialize the xml. With applications (per 
http://andrewdcraig.wordpress.com/2013/01/31/configmgr-2012-change-application-source-path/),
 there is a special serialization function in one of the admin console dlls, 
but I cannot find an equivalent function for configuration items.

Does anyone have any ideas on how I would go about doing this properly? This is 
what I have so far. The last step fails with an Invalid Digest Schema error.

$dcms = Get-CMConfigurationItem -Name "Current Firefox"
       $dcmxml = [xml]($dcms | Get-CMConfigurationItemXMLDefinition)
       #$rulever = $dcmxml.
       $dcmDocs = $dcmxml.model.instances.document
       foreach($doc in $dcmDocs)
       {
            if($doc.documentType -eq 0)
            {
                
$doc.data.DesiredConfigurationDigest.Application.Rules.Rule.Expression.Operands.ConstantValue.Value
 = "29.0"
            }
       }
       $dcms.SDMPackageXML = $dcmxml.OuterXml.Replace("`n","`r`n")
       Set-CMConfigurationItem -InputObject $dcms



Jesse Schauer
Windows Server Administrator II
University of Idaho ITS




Reply via email to