Powershell script to detect the Windows Azure SDK in Azure Cloud Service VM and fix the Powershell execution issue

When you try to run Powershell commands on Windows Azure Cloud Service (PaaS) VM you may have seen exception as below: PS D:\Users\avkash> Add-PSSnapin Microsoft.WindowsAzure.ServiceRuntime Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.WindowsAzure.ServiceRuntime because it is already added. Verify the name of the snap-in and try again. At line:1 char:13 + Add-PSSnapin <<<< Microsoft.WindowsAzure.ServiceRuntime +…

0