1
我试图通过PowerShell在Exchange上执行一些操作(Office 365)。通过PowerShell连接Office 365 Exchange Online
首先,我创建了一个新的PowerShell会话和导出的模块,以本地为“O365”,以便在以后的任何操作我没有必要使用进口PSSession可下载所需要的模块
$cred = Get-Credential
$s = New-PSSession -ConfigurationName "Microsoft.Exchange" -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Export-PsSession -session $s -outputModule o365
现在,我正在创建新会话并导入现有模块“o365”。
$cred = Get-Credential
$s = New-PSSession -ConfigurationName "Microsoft.Exchange" -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $cred -Authentication Basic -AllowRedirection
Import-Module o365
Get-DistributionGroup
在运行命令 “GET-DistributionGroup”,PowerShell的提示我再次进入办公室365个凭据。是否有可能避免再次输入凭据?我不想使用Import-PsSession,因为它需要更多时间。
我申请了上面的一个,但它仍然要求输入密码。现在我正在使用适合需要的Enter-PsSession,并解决了不需要使用Import-PsSession的问题。 – prabna