如何从命令行运行 Exchange 2007 PowerShell 脚本?
我有一个名为 MyScript.ps1 的非常基本的 PowerShell 脚本,它在 Exchange Management Shell 中运行得很好
: where { $_.Mounted -eq $True }
如果我尝试运行 powershell.exe MyScript.ps1
它会抱怨,因为它找不到 Get-MailboxDatabase cmdlet。我猜 PowerShell 和 Exchange Management Shell 的运行方式略有不同?
如何从命令行运行基于 Exchange 的 PowerShell 脚本?
I have a very basic PowerShell script called MyScript.ps1 that runs quite happily in the Exchange Management Shell:
Get-MailboxDatabase -Status | where { $_.Mounted -eq $True }
If I try to run powershell.exe MyScript.ps1
it complains because it can't find the Get-MailboxDatabase cmdlet. I'm guessing PowerShell and the Exchange Management Shell are running slightly differently?
How do I run an Exchange-based PowerShell script from the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要先加载 Exchange 管理管理单元,然后才能从命令行运行 Exchange 脚本。我相信代码会像这样:
You need to load the Exchange management snapin before you can run Exchange scripts from the command line. I believe the code would be like so: