Dienstag, 21. April 2020

[Office 365 Groups] Erstellen von Office 365 Groups mit Powershell

Mit folgendem Script kann man Microsoft Office 365 Groups per PowerShell erstellen.
Bitte die rot markierten Texte an die eigene Umgebung anpassen.
Damit das Script funktioniert, muss die erforderliche Powershell Erweiterung (Exchange) installiert sein.




##########################################################################
#Connect Exchange-Online
Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0") `
-Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName`
|?{$_ -notmatch "_none_"} | select -First 1)

$EXOSession = New-ExoPSSession

Import-PSSession $EXOSession -AllowClobber

#Defninieren der Groups Daten
$GroupName = "Der_Name_wie_die_Office365Groups_heißen_soll"
$GroupVisability = "Private"
$GroupMail = "MeineGroups365SMTPAdresse@yourcompany.com"
$GroupOwner = "BesitzerSMTPAdresse@yourcompany.com"

#Create Office 365 Group

New-UnifiedGroup -DisplayName "$GroupName" -Alias "$GroupName"

Start-Sleep -s 20

#Modify Office 365 Groups

Set-UnifiedGroup -Identity "$GroupName" -PrimarySmtpAddress "$GroupMail"
Set-UnifiedGroup -Identity "$GroupName" -HiddenFromAddressListsEnabled $false
Set-UnifiedGroup -Identity "$GroupName" -HiddenFromExchangeClientsEnabled:$false
Set-UnifiedGroup -Identity "$GroupName" -Language de-de
Set-UnifiedGroup -Identity "$GroupName" -AutoSubscribeNewMembers:$true
Set-UnifiedGroup -Identity "$GroupName" -RequireSenderAuthenticationEnabled $false
Set-UnifiedGroup -Identity "$GroupName" -AccessType "$GroupVisability"
Add-UnifiedGroupLinks -Identity "$GroupName" -LinkType Member -Links "$GroupOwner"
Add-UnifiedGroupLinks -Identity "$GroupName" -LinkType Owner -Links "$GroupOwner"

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.