开发者

How do I run a Exchange 2007 PowerShell script from the command line?

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开发者_如何学JAVA.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?


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:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜