When trying to run the Get-ExchangeServer cmdlet in PowerShell, you may get this error:
The term ‘Get-ExchangeServer’ is not recognized as the name of a cmdlet, functi
on, script file, or operable program. Check the spelling of the name, or if a p
ath was included, verify that the path is correct and try again.
At line:1 char:19
+ Get-ExchangeServer <<<< ServerNamer | Format-List Name,Domain,Site,fqdn,Serve
rRole
+ CategoryInfo : ObjectNotFound: (Get-ExchangeServer:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-ExchangeServer is not recognised by PowerShell because it’s not being run in an “Exchange PowerShell”.
To fix this, open a command prompt on the exchange server and run this:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command “. ‘C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto -ClientApplication:ManagementShell “
It takes a while to get going, but once that command has finished, you will be running an Exchange PowerShell and you should then be able to run Get-ExchangeServer successfully.