如何利用 PowerShell 隱藏 Office 365 群組
- 首先使用系統管理員身分啟動 PowerShell,並連線至 Exchange Online
$UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session -DisableNameChecking
- 隱藏指定的O365群組
Set-UnifiedGroup -Identity [email protected] -HiddenFromAddressListsEnabled $true
- 隱藏 類型是私人的O365群組
$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.AccessType -like "Private"} Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}
- 隱藏 類型是公開的O365群組
$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.AccessType -like "Public"} Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}
- 隱藏所有O365群組
$Groups = Get-UnifiedGroup -ResultSize Unlimited Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}
- 隱藏Teams 的O365群組
$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.ResourceProvisioningOptions -like "Team"} Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}
- 隱藏Teams 的私人O365群組
$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.ResourceProvisioningOptions -like "Team"} | ? {$_.AccessType -like "Private"} Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}
你必須 登入 才能發表評論。