office365 admin center 并不能添加guest用户,只能删除。添加guest用户,需要登录Azure ad portal。
office365 admin center但是这样做之后,仅仅能够将guest用户加入office365 group,而无法将其加入distribution group
关键命令:
#asks for office 365 credentials and stores them in
$UserCredentials$UserCredential = Get-Credential
#sets remote execution policy
Set-ExecutionPolicy RemoteSigned
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
# User prompts
$member = read-host -Prompt "Member [name_domain#EXT#]"
$identity = read-host -Prompt "DL Identity"
# add to DL
Add-DistributionGroupMember -Identity $identity -Member $member
# wait for user to hit any key incase there is an error
Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
图例:
网友评论