Set Office 365 Group Privacy to Private or Public using PowerShell

Requirement: Change Office 365 Group Privacy to Private or Public

How to Change Office 365 Group Privacy?
As an admin, you can change the Office 365 group's privacy through Microsoft 365 admin center. Here is how:
  • Login to the Microsoft 365 Admin Center site: https://admin.microsoft.com
  • Expand Groups and Click on Groups link in the left navigation. 
  • Select the Office 365 group you wish to rename
  • Click on Edit link next to Name column in the details pane.
  • On the Edit page, You can change the Privacy of the Office 365 group by selecting Private or Public from the drop down. 
    change office 365 group privacy to private or public using powershell
  • Click on "Save" to commit your changes. You should see "The group was updated." message.

Set Office 365 Group Privacy to Private or Public using PowerShell:
Lets change the privacy of "[email protected]" group to "Private".
#Get Credentials to connect
$Credential = Get-Credential
 
#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
           -Credential $Credential -Authentication Basic -AllowRedirection
 
#Import the session
Import-PSSession $Session -DisableNameChecking

#Set Office 365 group's privacy to "Private"
Set-UnifiedGroup -Identity "[email protected]" -AccessType Private

#Remove the session
Remove-PSSession $Session
Similarly, you can change the group type to "Public" as:
Set-UnifiedGroup -Identity "[email protected]" -AccessType Public

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.