Skip to content

Commit 92a9c55

Browse files
author
Hovsep
committed
Merge pull request #991 from stankovski/dev
Updates to MSI [#103628912]
2 parents c406895 + e338f42 commit 92a9c55

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

build.proj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@
197197
<!-- Copying shortcut to be signed -->
198198
<Copy SourceFiles="$(LibraryRoot)setup-powershellget\Setup\ShortcutStartup.ps1"
199199
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
200+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
201+
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
202+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
203+
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
200204

201205
<ItemGroup>
202206
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft*Azure*Commands*.dll" />
@@ -248,6 +252,10 @@
248252
<!-- Copying signed shortcut back -->
249253
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\ShortcutStartup.ps1"
250254
DestinationFolder="$(LibraryRoot)setup-powershellget\Setup" />
255+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
256+
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
257+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
258+
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
251259
</Target>
252260

253261
<Target Name="CodeSignInstaller">

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Finalizing installation of Azure PowerShell.
2626
Installing Azure Modules from PowerShell Gallery.
2727
This may take some time...
2828
"@
29-
$env:PSModulePath = "$env:HOME\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
29+
$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
3030

3131
Import-Module PackageManagement
3232

setup-powershellget/azurecmd.wxs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
3+
44
<?define productName="Microsoft Azure PowerShell - October 2015" ?>
55
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
66
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>
@@ -28,8 +28,6 @@
2828
<Property Id="ALLUSERS" Value="1" />
2929
<!-- per machine install-->
3030

31-
<Property Id="POWERSHELLEXE"><![CDATA[C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]]></Property>
32-
3331
<Property Id="PSCOMPATIBLEVERSION">
3432
<RegistrySearch Id="PSCOMPATIBLEVERSION" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" Name="PSCompatibleVersion" Type="raw" />
3533
</Property>
@@ -60,19 +58,17 @@
6058
</Directory>
6159

6260
<Property Id="POWERSHELLPATH">
63-
<RegistrySearch Id="POWERSHELLPATH"
61+
<RegistrySearch Id="POWERSHELLPATH"
6462
Type="raw"
6563
Root="HKLM"
6664
Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
6765
Name="ApplicationBase" />
6866
</Property>
6967

68+
<Property Id="POWERSHELLEXE" />
69+
<SetProperty Id="POWERSHELLEXE" Value="[POWERSHELLPATH]\powershell.exe" Before="AppSearch"/>
70+
7071
<DirectoryRef Id="PowerShellFolder">
71-
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
72-
<CreateFolder />
73-
<!-- Work around bug that PowerShell does not always consider default module paths. -->
74-
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[PowerShellFolder]ServiceManagement" System="yes" />
75-
</Component>
7672
<Component Id="AzureSdkShortcutScript" Guid="3d0d589a-b34c-4c48-9a4c-df78f286c6a3">
7773
<File Id="AzureSdkShortcutScriptFile" KeyPath="yes" Source="$(var.SolutionDir)\Setup\ShortcutStartup.ps1" />
7874
</Component>
@@ -92,15 +88,14 @@
9288
</DirectoryRef>
9389

9490
<Feature Id="azurecmd" Title="Microsoft Azure PowerShell" Level="1" Description="Windows PowerShell commandlets">
95-
<ComponentRef Id="PSModulePath.System" />
9691
<ComponentRef Id="AzureSdkShortcut" />
9792
<ComponentRef Id="AzureSdkShortcutScript" />
9893
</Feature>
9994

10095
<Binary Id="CustomActions" SourceFile="$(var.caSourceDir)\Microsoft.WindowsAzure.Setup.CA.dll"/>
101-
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
10296
<CustomAction Id="SetCustomActionDataValue" Return="check" Property="UpdatePSShortcut"
10397
Value="ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" />
98+
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
10499
<CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;Set-ExecutionPolicy RemoteSigned -Force&quot;" Execute="deferred" Impersonate="no" Return="check"/>
105100
<CustomAction Id="RunModuleInstallScript" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;. \&quot;[PowerShellFolder]\ShortcutStartup.ps1\&quot; -Install&quot;" Execute="deferred" Impersonate="no" Return="check"/>
106101

tools/AzureRM/AzureRM.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,15 @@ function Uninstall-AzureRM
105105

106106
Write-Output "Uninstalling AzureRM modules."
107107

108-
$installedModules = Get-InstalledModule
109-
110108
$AzureRMModules.Keys | ForEach {
111109
$moduleName = $_
112-
if (($installedModules | where {$_.Name -eq $moduleName}) -ne $null) {
110+
if ((Get-InstalledModule | where {$_.Name -eq $moduleName}) -ne $null) {
113111
Uninstall-Module -Name $_ -ErrorAction Stop
114112
Write-Output "$moduleName uninstalled..."
115113
}
116114
}
117115

118-
if (($installedModules | where {"AzureRM.Profile" -eq $moduleName}) -ne $null) {
116+
if ((Get-InstalledModule | where {"AzureRM.Profile" -eq $moduleName}) -ne $null) {
119117
Uninstall-Module -Name "AzureRM.Profile" -ErrorAction Stop
120118
Write-Output "AzureRM.Profile uninstalled..."
121119
}

0 commit comments

Comments
 (0)