准备
右击管理员打开PowerShell
设置PowerShell策略
Set-ExecutionPolicy RemoteSigned
PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned
执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): A
PS C:\Windows\system32>`
安装ExchangeOnlineManagement模块
Install-Module -Name ExchangeOnlineManagement
PS C:\Windows\system32> Install-Module -Name ExchangeOnlineManagement
执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): A
连接到ExchangeOnline
Connect-ExchangeOnline -UserPrincipalName admin@taiyoyudencn.partner.onmschina.cn -ExchangeEnvironmentName O365China
跳出密码框输入密码
PS C:\Windows\system32> Connect-ExchangeOnline -UserPrincipalName admin@taiyoyudencn.partner.onmschina.cn -ExchangeEnvironmentName O365China
----------------------------------------------------------------------------------------
This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn't require WinRM for Client-Server communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure.
Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.
V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently.
However, REST backed EOP and SCC cmdlets are not available yet. To use those, you will need to enable WinRM Basic Auth.
For more information check https://aka.ms/exov3-module
----------------------------------------------------------------------------------------
获取SmtpClientAuthenticationDisabled 全局状态信息
Get-TransportConfig | fl SmtpClientAuthenticationDisabled
PS C:\Windows\system32> Get-TransportConfig | fl SmtpClientAuthenticationDisabled
SmtpClientAuthenticationDisabled : True
PS C:\Windows\system32>
从以上输出可看出全局SMTP为禁用状态。
选项1-全局开启SMTP
Set-TransportConfig -SmtpClientAuthenticationDisabled $false
选项2-为个别邮箱开启SMTP
查看邮箱
Get-CASMailbox
对单个邮箱设置SMTP
Set-CASMailbox username -SmtpClientAuthenticationDisabled $false