Skip to content

Update-MSTCustomPolicyPackage

Teams: Update a custom policy package

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Identity,
    [string]$PolicyList,
    [string]$Description
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'Identity' = $Identity}

        if (-not [System.String]::IsNullOrWhiteSpace($PolicyList)) {
            $cmdArgs.Add('PolicyList', $PolicyList)
        }
        if (-not [System.String]::IsNullOrWhiteSpace($Description)) {
            $cmdArgs.Add('Description', $Description)
        }

        $result = Update-CsCustomPolicyPackage @cmdArgs | Select-Object *

        if ($null -eq $result) {
            Write-Output "Custom policy package updated"
            return
        }
        $result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
    }
    catch { throw }
}

Name of the custom package to update

Updated list of policies in the package, semicolon separated

Updated description of the custom package

An interactive directory of PowerShell scripts.