|  | 
| 27 | 27 |     <Property Id="ARPPRODUCTICON" Value="icon.ico" /> | 
| 28 | 28 |     <Property Id="ALLUSERS" Value="1" /> | 
| 29 | 29 |     <!-- per machine install--> | 
|  | 30 | +     | 
|  | 31 | +    <Property Id="POWERSHELLEXE"><![CDATA[C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]]></Property> | 
| 30 | 32 | 
 | 
| 31 | 33 |     <Property Id="PSCOMPATIBLEVERSION"> | 
| 32 | 34 |       <RegistrySearch Id="PSCOMPATIBLEVERSION" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" Name="PSCompatibleVersion" Type="raw" /> | 
| 33 | 35 |     </Property> | 
| 34 |  | - | 
| 35 |  | -    <Condition Message="This setup requires the Windows PowerShell 3.0 or compatible version to be installed."> | 
|  | 36 | +     | 
|  | 37 | +    <Condition Message="This setup requires the Windows PowerShell 5.0 or compatible version to be installed."> | 
| 36 | 38 |       <!-- This condition will break if PowerShell has version x3.0 and it is not compatible with 3.0 --> | 
| 37 |  | -      <![CDATA[Installed or (PSCOMPATIBLEVERSION >< "3.0")]]> | 
|  | 39 | +      <![CDATA[Installed or (PSCOMPATIBLEVERSION >< "5.0")]]> | 
| 38 | 40 |     </Condition> | 
| 39 | 41 | 
 | 
| 40 | 42 |     <PropertyRef Id="NETFRAMEWORK40FULL" /> | 
|  | 
| 71 | 73 |         <!-- Work around bug that PowerShell does not always consider default module paths. --> | 
| 72 | 74 |         <Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[PowerShellFolder]ServiceManagement" System="yes" /> | 
| 73 | 75 |       </Component> | 
|  | 76 | +      <Component Id="AzureSdkShortcutScript" Guid="3d0d589a-b34c-4c48-9a4c-df78f286c6a3"> | 
|  | 77 | +          <File Id="AzureSdkShortcutScriptFile" KeyPath="yes" Source="$(var.SolutionDir)\Setup\ShortcutStartup.ps1" /> | 
|  | 78 | +      </Component> | 
| 74 | 79 |     </DirectoryRef> | 
| 75 |  | - | 
|  | 80 | +     | 
| 76 | 81 |     <DirectoryRef Id="AzureSdkMenu"> | 
| 77 | 82 |       <Component Id="AzureSdkShortcut" Guid="A9B58A22-F746-451D-8840-F887D8014C3C"> | 
| 78 | 83 |         <Shortcut Id="AzureSdkStartMenuShortcut" | 
| 79 | 84 |                   Name="Microsoft Azure PowerShell" | 
| 80 | 85 |                   Description="Microsoft PowerShell cmdlets" | 
| 81 | 86 |                   Target="[POWERSHELLPATH]\powershell.exe" | 
| 82 |  | -                  Arguments="-NoExit -ExecutionPolicy Bypass -File "[PowerShellFolder]ServiceManagement\Azure\Services\ShortcutStartup.ps1""/> | 
|  | 87 | +                  Arguments="-NoExit -ExecutionPolicy Bypass -File "[PowerShellFolder]\ShortcutStartup.ps1""/> | 
| 83 | 88 |         <RemoveFolder Id="AzureSdkMenu" On="uninstall"/> | 
| 84 | 89 |         <RemoveFile Id="RemoveStaleFiles" Directory="StaleAzureSdkMenu" Name="Windows Azure PowerShell.lnk" On="both"/> | 
| 85 | 90 |         <RegistryValue Root="HKCU" Key="SOFTWARE\Microsoft\Microsoft SDKs\WindowsAzure\$(var.version)" Name="installed" Type="integer" Value="1" KeyPath="yes"/> | 
|  | 
| 89 | 94 |     <Feature Id="azurecmd" Title="Microsoft Azure PowerShell" Level="1" Description="Windows PowerShell commandlets"> | 
| 90 | 95 |       <ComponentRef Id="PSModulePath.System" /> | 
| 91 | 96 |       <ComponentRef Id="AzureSdkShortcut" /> | 
|  | 97 | +      <ComponentRef Id="AzureSdkShortcutScript" /> | 
| 92 | 98 |     </Feature> | 
| 93 | 99 | 
 | 
| 94 | 100 |     <Binary Id="CustomActions" SourceFile="$(var.caSourceDir)\Microsoft.WindowsAzure.Setup.CA.dll"/> | 
| 95 | 101 |     <CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/> | 
| 96 | 102 |     <CustomAction Id="SetCustomActionDataValue" Return="check" Property="UpdatePSShortcut" | 
| 97 | 103 |                      Value="ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" /> | 
|  | 104 | +    <CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command "Set-ExecutionPolicy RemoteSigned -Force"" Execute="deferred" Impersonate="no" Return="check"/> | 
|  | 105 | +    <CustomAction Id="RunModuleInstallScript" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command "\"[PowerShellFolder]\ShortcutStartup.ps1 -Install\""" Execute="deferred" Impersonate="no" Return="check"/> | 
| 98 | 106 | 
 | 
| 99 | 107 |     <InstallExecuteSequence> | 
| 100 | 108 |       <Custom Action="SetCustomActionDataValue" After="CreateShortcuts">NOT Installed</Custom> | 
| 101 | 109 |       <Custom Action="UpdatePSShortcut" After="SetCustomActionDataValue">NOT Installed</Custom> | 
|  | 110 | +      <Custom Action="SetExecutionPolicy" After="UpdatePSShortcut">NOT Installed</Custom> | 
|  | 111 | +      <Custom Action="RunModuleInstallScript" After="SetExecutionPolicy">NOT Installed</Custom> | 
| 102 | 112 |     </InstallExecuteSequence> | 
| 103 | 113 | 
 | 
| 104 | 114 |     <WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\media\License.rtf" /> | 
|  | 
0 commit comments