Share via


Exchange 2019: PowerShell Commands not recognized

Strange thing how Exchange will work and after a reboot you cannot run any commands.

In my previous post where we recovered the Exchange Security groups, all seemed fine until commands were run the Exchange Management Shell.

The famous error "The term 'command' was given for the simplest command "get-queue":

https://www.collaborationpro.com/wp-content/uploads/2018/12/EMC1.png

I went and checked and my account was an organisation admin, I could not even check the role group or the database availability group. To fix* this you need to run the following command (if on Exchange 2010, change V15 to V14)

  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\v15\bin\exshell.psc1" -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\v15\bin\Exchange.ps1'”

https://www.collaborationpro.com/wp-content/uploads/2018/12/EMC4.png

It basically re-launches the EMS inside itself but the fix only works in that current session, after you close and open it then it does not work again.