Skip to content

Instantly share code, notes, and snippets.

Param(
[Parameter (Mandatory= $true)]
[String] $autoAttendantName,
#Import the Azure AD Internals module.
Import-Module AADInternals
#Users to process
$Users = import-csv c:\temp\users.csv
foreach($user in $users){
$password = ConvertTo-SecureString $user.password -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList ($($user.upn), $password)
### Teams Devices Configuration Profiles Uploader ###
### Version 1.0 ###
### Author: Alexander Holmeset ###
### Email: alexander.holmeset@gmail.com ###
### Twitter: twitter.com/alexholmeset ###
### Blog: alexholmeset.blog ###
### Thanks to Jens Madsen for idea and extensive CSV ###
### with predefined configuration profiles. ###
### https://twitter.com/JensHMadsen ###
#Connect with source tenant
Connect-AzureAD
#Connect with destination tenant
Connect-ExchangeOnline
$DL = "distrobutionlist1","distrobutionlist2"
$SourceDomain = "alexholmeset.blog"
$DestinationDomain = "contoso.com"
$tenantId = 'xxxxxxxxxxx'
$ClientID = 'xxxxxxxxxxx'
$ClientSecret = 'xxxxxxxxxxx'
$users = "TestUser1@alexholmeset.onmicrosoft.com","TestUser2@alexholmeset.onmicrosoft.com"
#Number of hours the presence should be valid.
$Hours = "8"
$PSTfiles = dir 'c:\temp\pstfiles\PST Export_Export\03.16.2022-1208PM\Exchange' | Select-Object name
$filepath = "C:\temp\ImportPSTMapping.csv"
# Header for CSV file
"Workload,FilePath,Name,Mailbox,IsArchive,TargetRootFolder,ContentCodePage,SPFileContainer,SPManifestContainer,SPSiteUrl" | Out-File -Encoding utf8 -FilePath $filepath
foreach($PSTfile in $PSTfiles){
$ClientID = "1111111111"
$ClientSecret = "11111111"
$DeviceID = "111111111"
$WebHookURL = "https://contoso.com"
$formbody = "grant_type=client_credentials&scope=read%3Adevice%3Acurrent_values&client_id=$ClientID&client_secret=$ClientSecret"
$uri = "https://accounts-api.airthings.com/v1/token"
$Token = (Invoke-RestMethod -Method Post -Uri $uri -Body $formbody -ContentType "application/x-www-form-urlencoded" -UseBasicParsing).access_token
@AlexanderHolmeset
AlexanderHolmeset / TeamsFiletypesStatistics.ps1
Last active August 3, 2022 20:31
TeamsFiletypesStatistics
### Teams Filetype Statistics ###
### Version 1.1 ###
### Author: Alexander Holmeset ###
### Email: alexander.holmeset@gmail.com ###
### Twitter: twitter.com/alexholmeset ###
### Blog: alexholmeset.blog ###
#Need Azure App registration with Groupd.Read.All and Site.Read.All permissions.
### Team Owner Routine
### Version 1.0
### Author: Alexander Holmeset
### Email: alexander.holmeset@gmail.com
### Twitter: twitter.com/alexholmeset
### Blog: alexholmeset.blog
$TenantId = "Populate variable"
$ClientID = "Populate variable"
$ClientSecret = Get-AutomationVariable -Name 'secret'
### Azure AD / M365 profile picture uploader
### Version 1.0
### Author: Alexander Holmeset
### Email: alexander.holmeset@gmail.com
### Twitter: twitter.com/alexholmeset
### Blog: alexholmeset.blog
$TenantId = "xxxxxxx"
$ClientID = "xxxxxx"
$ClientSecret = "xxxxx"