Forum Discussion
JFM_12
Oct 24, 2023Iron Contributor
Powershell to get name of CQ and the Call Answering Method and Name of Team / Users-Groups
Hello Do you have a script that gives me the name of the CallQueue and the call answering method - Team - Chose users and groups What I would also need the name of Team or "Chose users and groups...
LeonPavesic
Oct 24, 2023Silver Contributor
Hi JFM_12,
here is an example code you could use:
# Import the Microsoft Teams PowerShell module
Import-Module MicrosoftTeams
# Get a list of all Call Queues
$callQueues = Get-CsCallQueue -Filter *
# Iterate through each Call Queue
foreach ($cq in $callQueues) {
Write-Host "Call Queue Name: $($cq.DisplayName)"
# Get Call Answering Method
$answeringMethod = Get-CsCallQueueInfo -Identity $cq.Identity
Write-Host "Call Answering Method: $($answeringMethod.CallAnsweringMethod)"
# Check if the answering method is 'Team'
if ($answeringMethod.CallAnsweringMethod -eq "Team") {
$team = Get-CsTeam -GroupId $cq.GroupId
Write-Host "Team Name: $($teamName)"
} else {
# Get the users and groups if not using 'Team'
$usersGroups = Get-CsCallQueueAgent -Identity $cq.Identity
Write-Host "Users/Groups:"
foreach ($userGroup in $usersGroups) {
Write-Host " - $($userGroup.AgentId)"
}
}
Write-Host "--------------------------------------"
}
# Disconnect from Microsoft Teams
Disconnect-MicrosoftTeams
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- JFM_12Oct 24, 2023Iron ContributorHello Leon
Hope you are having a great time.
Thank you very much
Doese give me if a Teams or a group/distribution group was used?
Regards
JFM_12- JFM_12Oct 25, 2023Iron Contributor
Hello
I tried to run the script but the terms "Get-CsCallQueueAgent" and "Get-CsCallQueueInfo" do not exist according to the output
Thank you for your reply
JFM_12