Created
August 19, 2020 23:44
-
-
Save sob/ba7e300bc6988399a4b5566222439dff to your computer and use it in GitHub Desktop.
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
Import-Module MSOnline | |
Import-Module AzureAD | |
Import-Module ExchangeOnlineManagement | |
$mailboxList = Import-Csv -Path '.\mailboxes.csv' | |
function CountDown() { | |
param($timeSpan) | |
while($timeSpan -gt 0) { | |
Write-Host '.' -NoNewline | |
$timeSpan = $timeSpan - 1 | |
Start-Sleep -Seconds 1 | |
} | |
} | |
ForEach ($mailbox in $mailboxList) { | |
Write-Host -NoNewline "Processing mailboxes [" | |
Write-Host -NoNewLine -ForegroundColor Yellow $mailbox.UserPrincipalName | |
Write-Host "]..." | |
Write-Host -NoNewline " provisioning mailbox as room..." | |
New-Mailbox -Name $mailbox.Username -Alias $mailbox.Username -Room -DisplayName $mailbox.DisplayName -EnableRoomMailboxAccount $true -MicrosoftOnlineServicesID $mailbox.UserPrincipalName -RoomMailboxPassword (ConvertTo-SecureString -String $mailbox.Password -AsPlainText -Force) | Out-Null | |
Write-Host -ForegroundColor Green " done!" | |
Write-Host -NoNewline " configuring mailbox..." | |
Set-CalendarProcessing -Identity $mailbox.username -AutomateProcessing AutoAccept -AddOrganizerToSubject $false -DeleteComments $false -DeleteSubject $false -RemovePrivateProperty $false -AddAdditionalResponse $true -AdditionalResponse "This is a Teams Meeting room!" -BookingWindowInDays 365 -OrganizerInfo $true | |
Write-Host -ForegroundColor Green " done!" | |
Write-Host -NoNewline " setting password not to expire" | |
Set-MsolUser -UserPrincipalName $mailbox.UserPrincipalName -PasswordNeverExpires $true | |
Write-Host -ForegroundColor Green " done!" | |
Write-Host -NoNewline " setting the usage location" | |
Set-MsolUser -UserPrincipalName $mailbox.UserPrincipalName -UsageLocation US | |
Write-Host -ForegroundColor Green " done!" | |
Write-Host -NoNewline " configuring the license for the mailbox..." | |
Set-MsolUserLicense -UserPrincipalName $mailbox.UserPrincipalName -AddLicenses "corpuschristisaints:MEETING_ROOM_FACULTY" | |
Write-Host -ForegroundColor Green " done!" | |
} | |
Write-Host -NoNewline "Waiting 2 minutes to configure TEAMS settings..." | |
CountDown -timeSpan 120 | |
ForEach ($mailbox in $mailboxList) { | |
Write-Host -NoNewline "Processing TEAMS settings [" | |
Write-Host -NoNewLine -ForegroundColor Yellow $mailbox.UserPrincipalName | |
Write-Host "]..." | |
Write-Host -NoNewline " configuring Teams Registration Pool..." | |
$pool = Get-CsOnlineUser -Identity $mailbox.UserPrincipalName | Select -ExpandProperty RegistrarPool -First 1 | |
Enable-CsMeetingRoom -Identity $mailbox.UserPrincipalName -RegistrarPool $pool -SipAddressType EmailAddress -WarningAction SilentlyContinue | |
Write-Host -ForegroundColor Green " done!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment