powershell - ADInvalidCredentialException 与 Exchange 2010 的 PowerShell 远程管理
问题描述
(我的英语不好)嗨,技术人员,
我正在尝试使用以管理员身份执行 cmd 的远程 PowerShell 获取邮箱统计信息。
powershell -command "$session=New-PSSession -ComputerName 'EX2' -Credential $cred; invoke-command -Session $session -ScriptBlock { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; dir env:}"
这个命令没问题
但我将命令更改为Get-MailboxDatabase
powershell -command "$session=New-PSSession -ComputerName 'EX2' -Credential $cred; invoke-command -Session $session -ScriptBlock { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; Get-MailboxDatabase -Status}"
我得到一个ADInvalidCredentialException
:
解决方案
您必须按如下方式连接到 Exchange Server:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ServerFQDN>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
然后要么:
一个)
Import-PSSession $Session -DisableNameChecking
Get-Mailbox
b)
Invoke-Command -Session $Session -ScriptBlock { Get-Mailbox }
推荐阅读
- android - 在本机反应中将图像上传到firebase:未定义不是一个函数
- python-3.x - 运行预训练 ImageAI 模型的问题
- android - 将身份验证令牌作为标头格式从客户端传递到远程服务器
- ios - 用于测试的 Flutter ios 构建
- javafx - 在按键上选择 ComboBox 选项。我希望选择模型自动滚动/跳转到所选选项
- sql - 如何每次列出两个不同日期的表之间的数据?
- python - PyCharm 远程解释器不在项目选项卡中显示站点包内容
- typescript - 等号 [=] 对高级类型意味着什么?
- javascript - vue js + firebase 和 [__ob__: Observer]
- python - 如何使用 64 位 windows 10 构建 32 位 exe 文件?