术语'remove-distributiongroupmember'不会被识别为cmdlet的名称

在PowerShell中必须为此错误导入哪些模块?

术语“remove-distributiongroupmember”不会被识别为cmdlet,函数,脚本文件或可操作程序的名称 . 检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试 .

回答(1)

2 years ago

Connect to Exchange Online PowerShell

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

#Your code here

Remove-PSSession $Session

Connect to Exchange servers using remote PowerShell

注意:将 mailbox01.contoso.com 替换为您自己的Exchange服务器 .

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://mailbox01.contoso.com/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session

#Your code here

Remove-PSSession $Session