使用 OAuth 创建 Powershell 会话失败
Create Powershell Session is failed using OAuth
正在尝试将脚本从基本身份验证更改为 Exchange Online V2 模块以利用现代身份验证。
Install-Module PowershellGet -Force
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install and test
Install-Module -Name ExchangeOnlineManagement
Get-Module ExchangeOnlineManagement -ListAvailable
$UserCredential = Get-Credential
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true
我得到的错误是
New-ExoPSSession : Create Powershell Session is failed using OAuth
我试过删除并重新安装该模块,但没有用
我在另一台机器上试过这个脚本,效果很好
我试过将代理参数设置为空,但没有用
我已经尝试使用 Microsoft 文档上的代码来仅利用现代身份验证而不是两个因素,没有工作
我主要使用这个来源,但在不同的地方四处寻找答案但没有运气。
https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps
我也遇到过同样的事情。我必须启用 winrm。
我用过:
winrm 快速配置
然后我必须为 WinRM 启用基本身份验证
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client]
"AllowBasic"=dword:00000001
之后我就可以正常连接了。
正在尝试将脚本从基本身份验证更改为 Exchange Online V2 模块以利用现代身份验证。
Install-Module PowershellGet -Force
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Install and test
Install-Module -Name ExchangeOnlineManagement
Get-Module ExchangeOnlineManagement -ListAvailable
$UserCredential = Get-Credential
Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true
我得到的错误是
New-ExoPSSession : Create Powershell Session is failed using OAuth
我试过删除并重新安装该模块,但没有用 我在另一台机器上试过这个脚本,效果很好 我试过将代理参数设置为空,但没有用 我已经尝试使用 Microsoft 文档上的代码来仅利用现代身份验证而不是两个因素,没有工作
我主要使用这个来源,但在不同的地方四处寻找答案但没有运气。
https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps
我也遇到过同样的事情。我必须启用 winrm。
我用过: winrm 快速配置
然后我必须为 WinRM 启用基本身份验证 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client] "AllowBasic"=dword:00000001
之后我就可以正常连接了。