When you execute the following command
Add-PSSnapin microsoft.exchange.powershell.snapin
You may get the following error:
Add-PSSnapin : The windows PowerShell snap-in 'microsoft.exchange.powershell.snapin' is not installed on this computer.
The solution is:
Slightly change the command as follows.
Add-PSSnapin microsoft.exchange.management.powershell.snapin