Last active
February 21, 2022 20:56
-
-
Save keslar/243e1a34eaca501fc6e42cb3cf8cf9c9 to your computer and use it in GitHub Desktop.
Teams Exports
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
$Assignmentsc = @() | |
$TelephoneNumbers = (Get-CsOnlineTelephoneNumber -ResultSize 1000000) | |
ForEach ( $TelephoneNumber in $TelephoneNumbers ) { | |
$Assignment = Get-CsOnlineTelephoneNumber -TelephoneNumber $TelephoneNumber -ExpandLocation | Select-Object id, inventorytype, userid, @{Name="CivicAddressId";Expression={"$($_.Location.CivicAddressId)"}},@{Name="LocationId";Expression={"$($_.Location.LocationId)"}} | |
$Assignments += $Assignment | |
} | |
$FileName = "$(Get-Date -F yyy-MM-dd)_Assignments.csv" | |
$Assignments | Export=CSV -NoTypeInformation -Path $FileName | |
$CivicAddresses = Get-CsOnlineLisCivicAddress -ResultSize 1000000 | Select-Object CivicAddressId,HouseNumber,HouseNumberSuffix,PreDirectional,StreetName,StreetSuffix,PostDirectional,City,CityAlias,PostalCode,StateOrProvince,CountryOrRegion,Description,CompanyName,DefaultLocationId,ValidationStatus,Latitude,Longitude,Elin | |
$FileName = "$(Get-Date -F yyy-MM-dd)-CivicAddresses.csv" | |
$CivicAddresses | Export-CSV -NoTypeInformation -Path $FileName | |
$Locations = Get-CsOnlineLisLocation -ResultSize 1000000 | Select-Object CivicAddressId, LocationId, Location | |
$FileName = "$(Get-Date -F yyy-MM-dd)_Locations.csv" | |
$Locations | Export-CSV -NoTypeInformation -Path $FileName | |
$ApplicationInstances = @() | |
$ApplicationInstances = Get-CsOnlineApplciationInstance -ResultSize 1000000 | Select-Object @{Name="Type";Expression = { if ($_.ApplicationId -eq "11cd3e2e-fccb-42ad-ad00-878b93575e07") { "CQ" } elseif ($_.ApplicationId-eq "ce933385-9390-45d1-9512-c8d228074e07" ) { "AA" } else { $null } } },DisplayName,ObjectId,PhoneNumber,UserPrincipalName | |
$FileName = "$(Get-Date -F yyy-MM-dd)_ApplicationInstances.csv" | |
$Locations | Export-CSV -NoTypeInformation -Path $FileName | |
$CallQueues = @() | |
$CallQueueDistrobutionLists = @() | |
$CallQueueUsers = @() | |
$CallQueueAgents = @() | |
$CallQueueApplicationInstances = @() | |
$AutoAttendants = @() | |
foreach ( $app in $ApplicaitonInstances ) { | |
if ( $app.ApplicationId -eq "11cd3e2e-fccb-42ad-ad00-878b93575e07" ) { | |
# Call Queue | |
$CallQueue = Get-CsCallQueue -Identity $app.ObjectId -Expand $true | |
#Statistics : System.Collections.ArrayList | |
#ApplicationInstances : System.Collections.ArrayList | |
$CallQueues += $CallQueue | Select Identity, Name, RoutingMethod, DistributionListsLastExpanded, AllowOptOut, ConferenceMode, PresenceBasedRouting, AgentsCapped, AgentsInSyncWithDistributionLists, AgentAlertTime, LanguageId, OverflowThreshold, OverflowAction, OverflowActionTarget, OverflowSharedVoicemailTextToSpeechPrompt,OverflowSharedVoicemailAudioFilePrompt,OverflowSharedVoicemailAudioFilePromptFileName, EnableOverflowSharedVoicemailTranscription, TimeoutThreshold, TimeoutAction,TimeoutActionTarget, TimeoutSharedVoicemailTextToSpeechPrompt,TimeoutSharedVoicemailAudioFilePrompt, TimeoutSharedVoicemailAudioFilePromptFileName, EnableTimeoutSharedVoicemailTranscription, WelcomeMusicFileName, UseDefaultMusicOnHold, MusicOnHoldFileName, ChannelId,OboResourceAccounts | |
foreach ( $DistroList in $CallQueue.DistributionLists ) { | |
$CallQueueDistrobutionLists += New-Object -TypeName PSObject -Property @{ CallQueueId = $CallQueue.Identity; DistrobutionListId = $DistroList.Guid } | |
} | |
foreach ( $User in $CallQueue.Users ) { | |
$CallQueueUsers += New-Object -TypeName PSObject -Property @{ CallQueueId = $CallQueue.Identity; UserId = $User.Guid } | |
} | |
foreach ( $Agent in $CallQueue.Agents ) { | |
$CallQueueAgents += New-Object-TypeName PSObject -Property @{ CallQueueId = $CallQueue.Identity; AgentId = Agent.Guid } | |
} | |
if ( ($CallQueue.OverflowSharedVoicemailAudioFilePromptFileName) -or ($CallQueue.TimeoutSharedVoicemailAudioFilePrompt) -or ($CallQueue.WelcomeMusicFileName) -or ($CallQueue.MusicOnHoldFileName) ) { | |
$AudioFileDirectory = "$(Get-Date -F yyy-MM-dd)_$($CallQueue.Name)" | |
New-Item -Path="." -Name=$AudioFileDirectory -ItemType "directory" | |
if ($CallQueue.OverflowSharedVoicemailAudioFilePromptFileName) { | |
$Audio = Export-CsOnlineAudioFile -Identity $CallQueue.OverflowSharedVoicemailAudioFilePromptFileName -ApplicationId HuntGroup | |
[System.IO.File]::WriteAllBytes("$($AudioFileDirectory)\$(OverflowSharedVoicemailAudioFilePromptFileName)", $Audio) | |
} | |
if ($CallQueue.TimeoutSharedVoicemailAudioFilePrompt) { | |
$Audio = Export-CsOnlineAudioFile -Identity $CallQueue.TimeoutSharedVoicemailAudioFilePrompt -ApplicationId HuntGroup | |
[System.IO.File]::WriteAllBytes("$($AudioFileDirectory)\$($CallQueue.TimeoutSharedVoicemailAudioFilePrompt)", $Audio) | |
} | |
if ($CallQueue.WelcomeMusicFileName) { | |
$Audio = Export-CsOnlineAudioFile -Identity $CallQueue.WelcomeMusicFileName -ApplicationId HuntGroup | |
[System.IO.File]::WriteAllBytes("$($AudioFileDirectory)\$($CallQueue.WelcomeMusicFileName)", $Audio) | |
} | |
if ($CallQueue.MusicOnHoldFileName) { | |
$Audio = Export-CsOnlineAudioFile -Identity $CallQueue.MusicOnHoldFileName -ApplicationId HuntGroup | |
[System.IO.File]::WriteAllBytes("$($AudioFileDirectory)\$($CallQueue.MusicOnHoldFileName)", $Audio) | |
} | |
} | |
foreach ( $instance in $CallQueue.ApplicationInstances ) {) | |
$CallQueueApplicationInstances += New-Object-TypeName PSObject -Property @{ CallQueueId = $CallQueue.Identity; ApplicationInstanceId = $instance.ApplicationInstances } | |
} | |
} elseif ( $app.ApplicationInstance -eq "ce933385-9390-45d1-9512-c8d228074e07" ) { | |
# Auto Attendant | |
$AutoAttendant = Get-CsAutoAttendant -Identity $app.ObjectId | |
$AutoAttendantDef = $AutoAttendant | Select-Object Identity, Name, LanguageId, VoiceId, DefaultCallFlow, | |
@{Name="OperatorId";Expression={$_.Operator.Id}}, | |
@{Name="OperatorType";Expression={$_.Operator.Type}}, | |
@{Name="OperatorEnableTranscription";Expression={$_.Operator.EnableTranscription}}, | |
@{Name="OperatorEnableSharedVoicemailSystemPromptSupression";Expression={$_.Operator.EnableSharedVoicemailSystemPromptSupression}}, | |
TimeZoneId, | |
VoiceResponseEnabled, | |
Status, | |
DailByNameResourceId, | |
DirectoryLookupScope | |
CallFlows | |
Schedules | |
CallHandlingAssoiations | |
@ApplicationInstances | |
@GreetingSettingAuthorizedUSers | |
} else { | |
"$($app.ApplciationInstance) - unknow application type [$($app.ApplicationInstance)]" | |
} | |
} | |
$ApplicationInstances | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_ApplicationInstances.csv" | |
$CallQueues | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallQueues.csv" | |
$CallQueueDistrobutionLists | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallQueueDistrobutionLists.csv" | |
$CallQueueUsers | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallQueueUsers.csv" | |
$CallQueueAgents | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallQueueAgents.csv" | |
$CallQueueApplicationInstances | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallQueueAgents.csv" | |
$AutoAttendants | |
#CallingLineIpentites | |
Get-CsCallingLineIdentity | Export-CSV -NoTypeInformation -Path "$(Get-Date -f YYYY-mm-DD)_CallingLineIdentities.csv" | |
# Policies | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment