forked from microsoft/FastTrack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#119 from tiagoroxo/master
New script (with improvemets + fix)
- Loading branch information
Showing
3 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<# | ||
.Description | ||
This Script function will help IT PROs find the Call Queues to which an specific Agent belongs. | ||
The only needed detail is the “User Principal Name” (UPN) of the Agent. | ||
Once you run the script, you will have to enter the UPN of the Agent, the outcome will give you the following details: | ||
- How many Call Queues the users belongs; | ||
- The details of the user (UPN/SIP/Phone) | ||
- The details of the Call Queue (QQ Name/QQ ID) | ||
You can read the outcome of report on the screen/shell or you view it in a CSV file. | ||
.Requirements | ||
- This Script function needs MicrosoftTeams module installed in the latest build. You can install it by running "Install-module MicrosoftTeams" or update it by "Update-module Microsoft Teams"; | ||
- Administrator rights to Install/Uninstall Modules; | ||
- Administrator rights in the tenant to list Teams Call Queue settings; | ||
- You must set ExecutionPolicy to allow running the script. Example: Set-ExecutionPolicy -ExecutionPolicy Unrestricted | ||
.PARAMETER: "AgentID" | ||
- This parameter will determine the Agent ID that you want to search. You need to type the User Principal Name (UPN of the account) | ||
.EXAMPLE: | ||
- ".\Get-AgentCQFinder -AgentID [email protected]" | ||
.Version: V1.0 | ||
.Author: Tiago Roxo | ||
#> | ||
|
||
#FUNCTION PARAMS | ||
param( | ||
[Parameter(Mandatory = $true,ParameterSetName='AgentID')] [string] $agentID | ||
) | ||
|
||
#Connecting to Microsoft Teams | ||
try{ | ||
cls | ||
Write-Host "Connecting to Microsoft Teams" -BackgroundColor White -ForegroundColor Black | ||
Read-Host -Prompt "Press enter to Start" | ||
Import-Module MicrosoftTeams | ||
Connect-MicrosoftTeams -LogLevel None -InformationAction SilentlyContinue | Out-Null | ||
cls | ||
}catch{ | ||
write-host "Problem loading Microsoft Teams Module - Make sure the Authentication is correct and make sure you latest version installed - https://www.powershellgallery.com/packages/MicrosoftTeams" -ForegroundColor Red | ||
$version = Get-Module MicrosoftTeams | ||
exit | ||
} | ||
|
||
Write-Host "Search for Agent:" $agentID -BackgroundColor White -ForegroundColor Black | ||
|
||
#Variables | ||
############################################################################################## | ||
$filePath = "$($env:USERPROFILE)\Downloads\" | ||
$fileName = "AgentCQFind_"+ (Get-Date).ToString('yyyy-MM-dd') +".csv" | ||
$file = $filePath+$fileName | ||
$users = @() | ||
|
||
|
||
#MAGIC STARTS HERE | ||
$cq = Get-CsCallQueue | ||
$userID = Get-CsOnlineUser -Identity $agentID | ||
foreach($i in $cq){ | ||
foreach($user in $i.Agents){ | ||
if ($user.ObjectId -eq $userID.identity) | ||
{ | ||
$users += [PSCustomObject]@{ | ||
UserPrincipalName = $userID.UserPrincipalName | ||
LineUri = $userID.LineUri | ||
SipAddress = $userID.SipAddress | ||
QueueName = $i.Name | ||
QueueID = $i.Identity | ||
} | ||
} | ||
} | ||
} | ||
|
||
if ($users){ | ||
Write-Host "Agent found in" ($users).count "Call Queues." -BackgroundColor Green -ForegroundColor White | ||
Write-Host "---------------------------------" | ||
foreach ($u in $users){$u.QueueName + " - " + $u.Queueid } | ||
Write-Host "---------------------------------" | ||
Write-Host "Saving Report to CSV File: "$file -BackgroundColor Green -ForegroundColor White | ||
$users | Export-Csv $file -NoTypeInformation -Encoding UTF8 -Delimiter ";" | ||
}else{Write-Host "User don't belong to any Call Queue" -BackgroundColor White -ForegroundColor Yellow} | ||
|
||
Read-Host -Prompt "Press enter to Exit" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Microsoft FastTrack Open Source - Get-AgentCQFinder | ||
|
||
This Script function will help IT PROs find the Call Queues to which an specific Agent belongs. | ||
The only needed detail is the “User Principal Name” (UPN) of the Agent. | ||
|
||
Once you run the script, you will have to enter the UPN of the Agent, the outcome will give you the following details: | ||
- How many Call Queues the users belongs; | ||
- The details of the user (UPN/SIP/Phone) | ||
- The details of the Call Queue (QQ Name/QQ ID) | ||
|
||
-You can read the outcome of report on the screen/shell or you view it in a CSV file. | ||
|
||
## Usage | ||
|
||
#### 1. Open PowerShell and run the following cmdlet: "Set-ExecutionPolicy -ExecutionPolicy Unrestricted" | ||
#### 2. Install/Update Microsoft Teams Powershell Module: | ||
- Install: Open PowerShell and run the following cmdlet: "Install-Module -Name MicrosoftTeams" | ||
- Update: Open PowerShell and run the following cmdlet: "Update-Module MicrosoftTeams" | ||
#### 3. You will need Office 365 tenant admin rights to access Call Queues details; | ||
#### 4. Once the above steps are completed, you can execute the script. | ||
- Open a Powershell and execute script. Example: **".\Get-AgentCQFinder -AgentID [email protected]"** | ||
#### | ||
- Once you execute the script, you will be prompt to enter your Office 365 tenant admin credentials; | ||
- The credentials will be used to obtain all the details from the Call Queues; | ||
- This script will only list data, won't do any change; | ||
#### ----> Always use the most recent version of the Script <---- | ||
#### Tool: | ||
![Tool](https://github.com/tiagoroxo/FastTrack/blob/master/scripts/Get-AgentCQFinder/Tool.jpg?raw=true) | ||
|
||
## Applies To | ||
|
||
- Microsoft Teams | ||
|
||
## Author | ||
|
||
|Author|Original Publish Date | ||
|----|-------------------------- | ||
|_Tiago Roxo_|_15/05/2022_| | ||
|
||
## Issues | ||
|
||
Please report any issues you find to the [issues list](https://github.com/microsoft/FastTrack/issues). | ||
|
||
|
||
## Support Statement | ||
|
||
The scripts, samples, and tools made available through the FastTrack Open Source initiative are provided as-is. These resources are developed in partnership with the community and do not represent official Microsoft software. As such, support is not available through premier or other Microsoft support channels. If you find an issue or have questions please reach out through the issues list and we'll do our best to assist, however there is no associated SLA. | ||
|
||
## Code of Conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Legal Notices | ||
|
||
Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the [MIT License](https://opensource.org/licenses/MIT), see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the [LICENSE-CODE](LICENSE-CODE) file. | ||
|
||
Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653. | ||
|
||
Privacy information can be found at https://privacy.microsoft.com/en-us/ | ||
|
||
Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, | ||
or trademarks, whether by implication, estoppel or otherwise. |