forked from Scine/Office365
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateO365SecretGroup.ps1
17 lines (10 loc) · 1020 Bytes
/
CreateO365SecretGroup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
##Create Office 365 group that is truly hidden, not just private. Private groups can still be found.
#Without 2FA authentication enabled uncomment this section.
#$UserCredential = Get-Credential
#Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
#Import-PSSession $Session
#With 2FA authentication enabled already. If you don't have this enabled, use the above section on line 6 and DISABLE the next 3 lines below by putting a # at the beginning of each line.
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
New-UnifiedGroup -DisplayName "Secret Group" -Alias "SecretGroup" -EmailAddresses "[email protected]" -AccessType Private -HiddenGroupMembershipEnabled