【发布时间】:2020-04-12 00:27:31
【问题描述】:
我正在尝试使用用户名和密码通过脚本连接到 PowerShell。当密码以空格开头时
passwordherebeginwithspace,认证失败。
会话创建行如下:
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection -ErrorAction Stop;
错误:
警告:您的连接已重定向到以下 URI: "https://ps.outlook.com/PowerShell-LiveID?PSVersion=5.1.17763.771" New-PSSession : [ps.outlook.com] 连接到远程服务器 ps.outlook.com 失败并显示以下错误消息:访问权限为 拒绝。
【问题讨论】:
-
我假设您正在使用
Get-Credentialcmdlet 填充$credential变量? -
是的。它适用于 office 365 登录等。但不适用于 powershell
标签: powershell office365