How to quickly determine the Windows Azure PowerShell Version

 

The quickest method to determine which Windows Azure PowerShell version you are running is to enable Debugging and then run a Power Shell command.

 

To enable debugging you just need to set $DebugPreference as below:

 

$DebugPreference ='Continue'

 

Example:

PS C:\Windows\System32\WindowsPowerShell\v1.0> $DebugPreference ='continue'

 

Now you can try any Windows Azure PowerShell command and because shell based debugging is enabled the shell will shows the request and response XML data along with all the headers. The one header we need to pay attention is “User-Agent”. In the User-Agent header we will see exactly what PS  version is making those PS based REST calls.

 

PS C:\Windows\System32\WindowsPowerShell\v1.0>get-azurelocation

 

DEBUG: ============================ HTTP REQUEST ============================

 

HTTP Method:

 GET

 

Absolute Uri:

 https://management.core.windows.net/9f79930d-18a8-40bc-a136-b592c6939aac/locations

 

Headers:

x-ms-version                : 2012-03-01

User-Agent                   : Windows Azure Powershell/v.0.6.10

 

The PowerShell version is contained within the User-Agent string "Windows Azure Powershell/v.0.6.10"

 

 

To disable debugging mode all you need to do is execute the following command:

 

PS C:\Windows\System32\WindowsPowerShell\v1.0> $DebugPreference ='Silentlycontinue'