Use PowerShell to get phone numbers and routing policy to users.
# Import the CSV file
$users = Import-Csv "path to users csv"
# Initialize an array to store the results
$results = @()
# Iterate through each user in the CSV
foreach ($user in $users) {
$userEmail = $user.Email
# Get the policy name for OnlineVoiceRoutingPolicy
$voiceRoutingPolicy = (Get-CsUserPolicyAssignment -PolicyType OnlineVoiceRoutingPolicy -Identity $userEmail).PolicyName
# Get the telephone number assignment
$telephoneNumber = (Get-CsPhoneNumberAssignment -AssignedPstnTargetId $userEmail).TelephoneNumber
# Create a custom object with the user's email, telephone number, and assigned policy
$userResult = [PSCustomObject]@{
Email = $userEmail
TelephoneNumber = $telephoneNumber
PolicyName = $voiceRoutingPolicy
}
# Add the user's result to the results array
$results += $userResult
}
# Export the results to a CSV file
$results | Export-Csv -Path "path to results csv" -NoTypeInformation