Skip to content

Get-MSTUserPolicyPackage

Teams: Get the policy package assigned to a user

#Requires -Version 5.1

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

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

        $result = Get-CsUserPolicyPackage @getArgs | Select-Object *

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

The user that will get their assigned policy package

An interactive directory of PowerShell scripts.