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
Param( | |
[Parameter (Mandatory= $true)] | |
[String] $teamname, | |
[Parameter (Mandatory= $true)] | |
[String] $owner | |
) | |
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
Param( | |
[Parameter (Mandatory= $true)] | |
[String] $teamname, | |
[Parameter (Mandatory= $true)] | |
[String] $owner, |
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
#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" |
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
$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'){ |
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
$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){ | |
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
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 |
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
### Microsoft Planner Tenant To Tenant Migration Script ### | |
### ### | |
### Version 1.0 ### | |
### ### | |
### Author: Alexander Holmeset ### | |
### ### | |
### Twitter: twitter.com/alexholmeset ### | |
### ### | |
### Blog: alexholmeset.blog ### |
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
### 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" |
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
#"Password!" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "D:\temp\PassordUserExpireScript.txt" | |
$Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "admin@contoso", (Get-Content "d:\temp\PassordUserExpireScript.txt" | ConvertTo-SecureString) | |
#Gets all users thats enabled and have a expiration date. | |
$Users = Get-ADUser -Filter * -Properties AccountExpirationDate | select AccountExpirationDate,Enabled,UserPRincipalName,samaccountname,name | Where-Object{$_.Enabled -eq $true -and $_.AccountExpirationDate} | |
#Todays date. | |
$today = Get-Date -Format dd/MM/yyyy |
OlderNewer