We can run Exchange Management Powershell cmdlets using Exchange Management Shell to get exchange related details. However, If you are working with normal PowerShell console instead of Exchange Management Shell, you need to import Exchange snapins to enable and use Exchange Management cmdlets.
If you run the Exchange commands in Powershell (Ex: Get-Mailbox) without loading the Exchange Management cmdlets, you will get the following error:
The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:12 + Get-Mailbox <<<< + CategoryInfo : ObjectNotFound: (Get-Mailbox:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Run the following command to load Exchange Powershell cmdlets that supports Admin tasks.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
-or- Run the following command if you want to enable all the Exchange related cmdlets.
Add-PSSnapin "Exchange*
Note: The Exchange Management Powershell cmdlets will be available only if the Exchange System Management Tools installed in your machine. Otherwise, you need to use Exchange Cmdlets through Remote Exchange Powershell. Read this article to Connect Remote Exchange PowerShell.
Advertisement
Add-PSSnapin "*Exchange*" is the correct syntax
For Exchange 2007:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin