Skip to content

Instantly share code, notes, and snippets.

#Specify users you need to extract contactlist from.
$users = "alexander@contoso.com"
#Specify contactlist folder you need to export. Have added wildcard in the request, so if you are exporting all folders thats starts with Skype, enter "Skype" as foldername.
#Enter "root" as foldername if you want all contacts that are not in a folder.
$folder = "skype"
function Get-MSGraphAppToken{
<# .SYNOPSIS
### 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"
$connection = Get-AutomationConnection -Name AzureRunAsConnection
$tenant = 'alexholmeset.onmicrosoft.com'
Connect-ExchangeOnline -CertificateThumbprint $connection.CertificateThumbprint -AppId $connection.ApplicationID -ShowBanner:$false -Organization $tenant
Get-MessageTrace
#Teams and SharePoint usage data consolidation script
#Author: Alexander Holmeset
#Twitter: @AlexHolmeset
function Get-MSGraphAppToken{
<# .SYNOPSIS
Get an app based authentication token required for interacting with Microsoft Graph API
.PARAMETER TenantID
A tenant ID should be provided.
@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 ###
$credential = Get-AutomationPSCredential -Name 'Exchange'
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'https://outlook.office365.com/powershell-liveid/' -Credential $credential -Authentication Basic -AllowRedirection
Import-Module (Import-PSSession -Session $session -DisableNameChecking -AllowClobber ) -Global
$TodaysDate = Get-Date (Get-Date).AddDays(-1) -Format 'MM/dd/yyyy'
$NumberOfInternalEmails = (Get-MessageTrace -StartDate $TodaysDate -EndDate $TodaysDate | Where-Object{$_.'SenderAddress' -like '*alexholmeset.onmicrosoft.com'} | Where-Object{$_.'RecipientAddress' -like '*alexholmeset.onmicrosoft.com'}).count
#Set Defaults (Optional) which allows you to skip defining instance, user, and password each time
$AzureDefaultInstanceName = "ServerName"
$AzureDefaultDatabaseName = "DatabaseName"
$username = Get-AutomationVariable -Name 'Administrator'
$password = Get-AutomationVariable -Name 'Password'
#The actual function
$url = 'https://tas.teams.microsoft.com/v2/teams/summary-timeseries?timeperiod=last-ninety-days&includeTimeSeries=ActiveUsers&metrics=all&pagesize=20&nextCursor=null'
$token = 'CI6IjE4YzRhOTFiLTRmYTktNGZiZC1hYjFjLWIzOTQ'
$Header = @{"Authorization" = "Bearer $token" }
$data = Invoke-RestMethod -Uri $url -Method GET -Headers $Header -ContentType 'application/json'
$url = 'https://tas.teams.microsoft.com/v2/teams/summary-timeseries?timeperiod=last-ninety-days&includeTimeSeries=ActiveUsers&metrics=all&pagesize=20&nextCursor=null'
$token = 'CI6IjE4YzRhOTFiLTRmYTktNGZiZC1hYjFjLWIzOTQ'
$Header = @{"Authorization" = "Bearer $token" }
$data = Invoke-RestMethod -Uri $url -Method GET -Headers $Header -ContentType 'application/json'
#Set Defaults (Optional) which allows you to skip defining instance, user, and password each time
$AzureDefaultInstanceName = "teamssqlserver"
$AzureDefaultDatabaseName = "teamssqldatabase"
$AzureDefaultUserID = "username"
$AzureDefaultPassword = "password"
#The actual function
Function get-azureSQL (
[string]$DatabaseName = $AzureDefaultDatabaseName,