Here is the work around : Update the following registry key using a startup task.
HKLM\Software\Microsoft\PowerShell\1\PowershellSnapIns
Change the AssemblyName, Version properties to refer the version number of 1.7.0.0 instead of 1.0.0.0
You can refer the sample code provided in the below link :
http://blogs.msdn.com/b/codefx/archive/2012/04/11/sample-of-apr-11st-add-registry-entries-to-vms-running-in-windows-azure-programmatically.aspx
Steps for work around:
=================================================
1. Change AssemblyName and Version Properties to refer to the version number of 1.7.0.0 instead of 1.0.0.0.
How to create a .reg file : Make the appropriate changes in the registry, and then export the appropriate subkey or subkeys. Exported registry subkeys are
automatically saved as .reg files.
- Click
Start, click Run, type regedit in the
Open box, and then click OK.
- Locate and then click the subkey that holds the registry item or items that you want to change.
- Click
File, and then click Export. This step backs up the subkey before you make any changes. You can import this file back into the registry later if your changes cause a problem.
- In the
File name box, type a file name to use to save the .reg file with the original registry items, and then click
Save.
ChangeVersion.reg
==============
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.WindowsAzure.ServiceRuntime]
"ApplicationBase"="E:\\plugins\\RemoteAccess"
"AssemblyName"="Microsoft.WindowsAzure.ServiceRuntime.Commands, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
"Description"="Provides access to the Windows Azure runtime environment."
"ModuleName"="E:\\plugins\\RemoteAccess\\Microsoft.WindowsAzure.ServiceRuntime.Commands.dll"
"PowershellVersion"="1.0"
"Vendor"="Microsoft"
"Version"="1.7.0.0"
2. Create a batch file : ChangeRegistrySetting.cmd
@echo off
regedit.exe /s ChangeVersion.reg
exit /b 0
3. Code change in ServiceDefinition file
<Startup>
<Task commandLine="ChangeRegistrySetting.cmd" executionContext="elevated" taskType="simple">
</Task>
</Startup>
<Sites>
4. Set “Copy to output Directory = Copy always”
for both .cmd and .reg file
5. Deploy the application, RDP into the VM, open powershell command prompt and execute the below command: add-pssnapin microsoft.windowsazure.serviceruntime
Sri Harsha