Last active
October 2, 2023 14:55
-
-
Save JeffBrownTech/9e2c34d507115357bfeac9a4fe3ef6f4 to your computer and use it in GitHub Desktop.
Get Teams Voice User Information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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