Skip to content

Instantly share code, notes, and snippets.

@mozziemozz
Last active April 15, 2022 20:50
Show Gist options
  • Save mozziemozz/46f9c147d0144829efd81e9a79ab7d4c to your computer and use it in GitHub Desktop.
Save mozziemozz/46f9c147d0144829efd81e9a79ab7d4c to your computer and use it in GitHub Desktop.
Get-CallQueueAgentList
function Get-CallQueueAgentList {
param (
[Parameter(Mandatory=$false)][bool]$Export
)
$CallQueueList = Get-CsCallQueue | Select-Object Name, Identity | Out-GridView -Title "Choose a Call Queue from the List" -PassThru
$CallQueue = Get-CsCallQueue -Identity $CallQueueList.Identity
$CallQueueAgents = $CallQueue.Agents
$AgentList = @()
foreach ($Agent in $CallQueueAgents) {
$AgentProperties = New-Object -TypeName psobject
$SfBAgent = Get-CsOnlineUser -Identity $Agent.ObjectId
$AgentProperties | Add-Member -MemberType NoteProperty -Name "User Principal Name" -Value $SfBAgent.UserPrincipalName
$AgentProperties | Add-Member -MemberType NoteProperty -Name "OptIn Status" -Value $Agent.OptIn
$AgentList += $AgentProperties
}
Write-Host "The Call Queue $($CallQueue.Name) has the following members:" -ForegroundColor Yellow
$AgentList
if ($Export) {
$AgentList | Export-Csv -Path ".\CallQueueAgentList.csv" -NoTypeInformation -Encoding UTF8 -Delimiter ";" -Force
Write-Host "Properties of Call Queue $($CallQueue.Name) exported to current directory."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment