locked
How to check if MSIProductCode for SourceManagement under SCCM DeploymentType already exists. RRS feed

  • Question

  • Hi,

    I have a script to set MSI ProductCode for Source Management within DeploymentType of an SCCM Application Model. I use the powershell commandlet 'Set-CMScriptDeploymentType' do achieve this. However, I would like to know if there is a way to check if a ProductCode string already exists in that location before I proceed with setting one. How can I do so?

    Thanks,



    • Edited by DS2885 Saturday, July 7, 2018 9:26 AM
    Friday, July 6, 2018 4:36 PM

Answers

  • Nevermind, found out a way myself using the configmgr commandlet :)

    Code:

    $DT = Get-CMDeploymentType -ApplicationName [Name of the Application]

    [String]$DTINFO = $DT    '''''Save DeploymentType info within a string

    $SMPCODE = "<SourceUpdateProductCode>"+[MSIPRODUCTCODE]

    IF ($DTINFO.contains($SMPCODE)){

    Write-Host "ProductCode already Exist"

    } Else {

    Write-Host "Does Not Exit"

    }


    • Edited by DS2885 Monday, July 9, 2018 3:53 PM rectified syntax error in code
    • Marked as answer by DS2885 Monday, July 9, 2018 3:54 PM
    Monday, July 9, 2018 3:20 PM