Getting an error when you open Exchange Management Console/Shell

When you open exchange Managment console or shell on exchange 2010, you may get an error as below

Connecting to remote server failed with the following error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management protocol. For more information, see the about_Remote_Troubleshooting Help topic.

The main issue for this error related to Powershell virtual Directory is removed on IIS of the affected server.

To fix this issue, You need to recreate the PowerShell VD by using Windows PowerShell by run

New-PowershellVirtuallirectory -Name PowerShell

You need to load the exchange Snap-in in order to run the exchange command from Windows Powershell by run:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 

When I run the above command, I got error "The Windows Powershell snap-in 'Microsoft.exchange.Management.powershell.E2010' is not installed on this machine"

Found that HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.E2010 is missing on affected Machine..
I exported from different server.. and imported to affected machine..

And then I am able to run the  New-PowershellVirtuallirectory  command successfully and new PowerShell VD get created.
we are able to open EMC and EMS successfully..