Skip to content

Remove-MSTCustomPolicyPackage

Teams: Delete a custom policy package

#Requires -Version 5.1

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

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

        $result = Remove-CsCustomPolicyPackage @cmdArgs

        [PSCustomObject]@{
            Timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
            Identity  = $Identity
            Status    = if ($null -eq $result) { 'Custom policy package removed' } else { $result.ToString() }
        }
    }
    catch { throw }
}

Name of the custom package to delete

An interactive directory of PowerShell scripts.