Skip to content

Instantly share code, notes, and snippets.

### Teams Auto Attendant Holiday Schedule Generator ###
### Version 1.0 ###
### Author: Alexander Holmeset ###
### Email: alexander.holmeset@gmail.com ###
### Twitter: twitter.com/alexholmeset ###
### Blog: alexholmeset.blog ###
#Enter you AutoAttendant ID
$AutoAttendantID = "159980fb-ec85-4c3d-b8be-e09a2a17f4eb"
@AlexanderHolmeset-zz
AlexanderHolmeset-zz / PlannerMigration.ps1
Last active September 3, 2020 17:23
Microsoft Planner Tenant To Tenant Mirgration
### Microsoft Planner Tenant To Tenant Migration Script ###
### ###
### Version 1.0 ###
### ###
### Author: Alexander Holmeset ###
### ###
### Twitter: twitter.com/alexholmeset ###
### ###
### Blog: alexholmeset.blog ###
try{Invoke-RestMethod -Body $RequestBody -Method POST -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $token"}}
catch{
$ResponseResult = $_.Exception.Response.GetResponseStream()
$ResponseReader = New-Object System.IO.StreamReader($ResponseResult)
$ResponseBody = $ResponseReader.ReadToEnd()
}
$ResponseBody
$Users = Import-Csv -Path "c:\temp\users.csv"
foreach($user in $Users){
#Gets all unassigned number ranges. This needs to be done for each user in the foreach loop, as you keep changing the ranges.
$UnasignedNumbers = Get-CsUnassignedNumber
#Need to loop through all ranges to find which one the users number belong to.
foreach($Range in $UnasignedNumbers){
$GIFStats = @()
$apiUrl = "https://graph.microsoft.com/v1.0/groups"
$myProfile = Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken"} -Uri $apiUrl -Method Get
$teams = $myProfile.value
foreach($team in $teams){
if($team.resourceProvisioningOptions -eq 'Team'){
#Application logon
# Azure AD OAuth Application Token for Graph API
# Get OAuth token for a AAD Application (returned as $token)
#Application (client) ID, tenant ID and secret
$clientId = "xxxx"
Param(
[Parameter (Mandatory= $true)]
[String] $teamname,
[Parameter (Mandatory= $true)]
[String] $owner,
Param(
[Parameter (Mandatory= $true)]
[String] $teamname,
[Parameter (Mandatory= $true)]
[String] $owner
)