New-MSTCustomPolicyPackage
Teams: Create a custom policy package
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$Identity,
[Parameter(Mandatory = $true)]
[string]$PolicyList,
[string]$Description
)
Process {
try {
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'Identity' = $Identity; 'PolicyList' = $PolicyList}
if (-not [System.String]::IsNullOrWhiteSpace($Description)) {
$cmdArgs.Add('Description', $Description)
}
$result = New-CsCustomPolicyPackage @cmdArgs | Select-Object *
if ($null -eq $result) {
Write-Output "Custom policy package created"
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
List of policies included in the package, semicolon separated. Format: "<PolicyType>, <PolicyName>"
Description of the custom package