Skip to content

Instantly share code, notes, and snippets.

View mozziemozz's full-sized avatar
🏠
Working from home

Martin Heusser mozziemozz

🏠
Working from home
View GitHub Profile

Get Settings of a user

Get call forwarding settings of a user

Get-CsUserCallingSettings -Identity wendy@domain.com

Delegates

Get people who support a user (delegates)

(gci -File | ? {$_.Extension -eq ".csv" -and $_.Name -match "DirectRouting"}).Name | Import-Csv -Delimiter "," | Export-Csv -Path .\drExport.csv -Delimiter ";" -Encoding UTF8 -NoTypeInformation -Force
@mozziemozz
mozziemozz / CallQueueOptInOptOut.ps1
Last active March 28, 2022 16:32
Remotely change the opt in status of a Teams Call Queue Agent
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)][String]$UserId, # AAD User Object Id
[Parameter(Mandatory=$false)][String]$UserName, # AAD User Name
[Parameter(Mandatory=$false)][String]$TenantName, #your primary domain or *.onmicrosoft.com domain
[Parameter(Mandatory=$false)][String]$CallQueueId, # Call Queue Id
[Parameter(Mandatory=$false)][ValidateSet("OptIn","OptOut")][String]$Action,
[Parameter(Mandatory=$false)][Switch]$QueryStatusOnly,
[Parameter(Mandatory=$false)][Switch]$MFA
$teamsRegion = Read-Host "Enter your Teams region. E.g. 'emea'"
function Get-UserToken {
param (
)
# Tenant name or id
$tenantName = Read-Host "Enter your primary M365 domain or *.onmicrosoft.com name."
Add-Type -AssemblyName System.Web
$callQueues = Get-CsCallQueue
foreach ($callQueue in $callQueues) {
Set-CsCallQueue -Identity $callQueue.Identity -OverflowThreshold $callQueue.OverflowThreshold
}
@mozziemozz
mozziemozz / Get-CallQueueAgentList
Last active April 15, 2022 20:50
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
# import required functions from this repository
. .\Functions\Connect-M365CFV.ps1
. .\Functions\Get-TeamsUserCallFlow.ps1
$allTeamsUsers = Get-CsOnlineUser -Filter {accountEnabled -eq $true}
$teamsUserCounter = 1
foreach ($teamsUser in $allTeamsUsers) {
param
(
[Parameter (Mandatory = $false)]
[object] $WebhookData
)
$uri = ""
$Body = (ConvertFrom-Json -InputObject $WebhookData.RequestBody)
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$uri = ""
$refreshUri = ""
$actionCardAa = @'
{
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
$action = $Request.Body.action
$uri = ""
$body = @'