MECM - Get-CMSoftwareUpdateAutoDeploymentRule

Love Arvidsson 116 Reputation points
2021-08-06T10:43:11.44+00:00

Hi!

Im working on some scripting with "Get-CMSoftwareUpdateAutoDeploymentRule" & "New-CMSoftwareUpdateAutoDeploymentRule" and ran into some problem when trying to figure out how to copy "UpdateClassification" & "Severity" properites from one rule to the next.

When you use the Get-cmdlt you would be returned the follwing values for eg Severity:

'10'
'8'
'2'
'6'
'0'

And for "_UpdateClassification":
<string>'UpdateClassification:e6cf1350-c01b-414d-a61f-263d14d133b4'</string>
<string>'UpdateClassification:e0789628-ce08-4437-be74-2495b842f43b'</string>
<string>'UpdateClassification:0fa1201d-4330-4fa8-8ae9-b877473b6441'</string>
<string>'UpdateClassification:68c5b0a3-d1a6-4553-ae49-01d3a7827828'</string>

When you use "New"-Cmdlet these properties needs to be specified as strings, eg "Critical" for severity, and "Critical Updated" for _UpdateClassification.

Just thought i would check if there is some easy way to "convert" these into a usable stringvalue to be used with "New-", like you can do with "_Products" (Using the ID returned with "Get-CMSoftwareUpdateCategory" to get the ProductName) or do i just have to start working on some more code to get this done ^^

Thank you,
Best regards!

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
Microsoft Configuration Manager Updates
Microsoft Configuration Manager Updates
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Updates: Broadly released fixes addressing specific issue(s) or related bug(s). Updates may also include new or modified features (i.e. changing default behavior).
1,012 questions
Microsoft Configuration Manager
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. HanyunZhu-MSFT 1,846 Reputation points
    2021-08-09T06:25:52.567+00:00

    Hi @Love Arvidsson ,

    Thanks for posting in Microsoft Q&A forum.

    To this issue, we could set these properties as variables, and fill in the variables in the new rule.

    For example,

    $a = ((get-cmdlt).property1).tostring()  
    $b = ((get-cmdlt).property2).tostring()  
      
    new-cmdlet -para1 $a, -para2 $b, -para3 "abc", -para4 $false  
    

    For more information about use new-cmdlet to create an automatic deployment rule (ADR) for software updates, please refer to:
    https://learn.microsoft.com/en-us/powershell/module/configurationmanager/new-cmsoftwareupdateautodeploymentrule?view=sccm-ps
    We could find some examples in this link and use them as references.

    Hope the above information can help you.


    If the response is helpful, please click "Accept Answer"and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.