Skip to content

Instantly share code, notes, and snippets.

@JeffBrownTech
Last active October 2, 2023 14:55
Show Gist options
  • Save JeffBrownTech/9e2c34d507115357bfeac9a4fe3ef6f4 to your computer and use it in GitHub Desktop.
Save JeffBrownTech/9e2c34d507115357bfeac9a4fe3ef6f4 to your computer and use it in GitHub Desktop.
Get Teams Voice User Information
$userPhoneNumbers = Get-CsPhoneNumberAssignment -CapabilitiesContain UserAssignment -Top ([int]::MaxValue)
foreach ($number in $userPhoneNumbers) {
if ($null -ne $number.AssignedPstnTargetId) {
$user = Get-CsOnlineUser -Identity $number.AssignedPstnTargetId
}
else {
$user = [PSCustomObject]@{
DisplayName = "Not Assigned"
UserPrincipalName = $null
}
}
$location = Get-CsOnlineLisLocation -LocationId $number.LocationId
$output = [PSCustomObject]@{
TelephoneNumber = $number.TelephoneNumber
AssignedUser = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
LocationId = $location.LocationId
Description = $location.Description
Place = $location.Location
}
$output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment