当密码以空白 space 开头时,连接到 Office 365 powershell 失败
Connect to Office 365 powershell is failing when password begins with blank space
我正在尝试使用用户名和密码通过脚本连接到 PowerShell。当密码以space开头时-like
passwordherebeginwithspace
,认证失败。
会话创建行如下:
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection -ErrorAction Stop;
错误:
WARNING: Your connection has been redirected to the following URI:
"https://ps.outlook.com/PowerShell-LiveID?PSVersion=5.1.17763.771 "
New-PSSession : [ps.outlook.com] Connecting to remote server
ps.outlook.com failed with the following error message : Access is
denied.
根据Office 365 Password Policy,仅云用户不允许在密码中包含space。
这是我过去遇到的情况,服务的一部分可以正常工作(例如 Outlook),而另一部分会失败(例如 Sharepoint)。该要求并不总是严格执行。它可能会有所不同,具体取决于用于设置密码的方法(Web 登录表单与管理员使用 PowerShell 分配的密码)。
我正在尝试使用用户名和密码通过脚本连接到 PowerShell。当密码以space开头时-like
passwordherebeginwithspace
,认证失败。
会话创建行如下:
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection -ErrorAction Stop;
错误:
WARNING: Your connection has been redirected to the following URI: "https://ps.outlook.com/PowerShell-LiveID?PSVersion=5.1.17763.771 " New-PSSession : [ps.outlook.com] Connecting to remote server ps.outlook.com failed with the following error message : Access is denied.
根据Office 365 Password Policy,仅云用户不允许在密码中包含space。
这是我过去遇到的情况,服务的一部分可以正常工作(例如 Outlook),而另一部分会失败(例如 Sharepoint)。该要求并不总是严格执行。它可能会有所不同,具体取决于用于设置密码的方法(Web 登录表单与管理员使用 PowerShell 分配的密码)。