Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@
<!-- Copying shortcut to be signed -->
<Copy SourceFiles="$(LibraryRoot)setup-powershellget\Setup\ShortcutStartup.ps1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />

<ItemGroup>
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft*Azure*Commands*.dll" />
Expand Down Expand Up @@ -248,6 +252,10 @@
<!-- Copying signed shortcut back -->
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\ShortcutStartup.ps1"
DestinationFolder="$(LibraryRoot)setup-powershellget\Setup" />
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
</Target>

<Target Name="CodeSignInstaller">
Expand Down
2 changes: 1 addition & 1 deletion setup-powershellget/Setup/ShortcutStartup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Finalizing installation of Azure PowerShell.
Installing Azure Modules from PowerShell Gallery.
This may take some time...
"@
$env:PSModulePath = "$env:HOME\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"

Import-Module PackageManagement

Expand Down
17 changes: 6 additions & 11 deletions setup-powershellget/azurecmd.wxs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<?define productName="Microsoft Azure PowerShell - October 2015" ?>
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>
Expand Down Expand Up @@ -28,8 +28,6 @@
<Property Id="ALLUSERS" Value="1" />
<!-- per machine install-->

<Property Id="POWERSHELLEXE"><![CDATA[C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]]></Property>

<Property Id="PSCOMPATIBLEVERSION">
<RegistrySearch Id="PSCOMPATIBLEVERSION" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" Name="PSCompatibleVersion" Type="raw" />
</Property>
Expand Down Expand Up @@ -60,19 +58,17 @@
</Directory>

<Property Id="POWERSHELLPATH">
<RegistrySearch Id="POWERSHELLPATH"
<RegistrySearch Id="POWERSHELLPATH"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
Name="ApplicationBase" />
</Property>

<Property Id="POWERSHELLEXE" />
<SetProperty Id="POWERSHELLEXE" Value="[POWERSHELLPATH]\powershell.exe" Before="AppSearch"/>

<DirectoryRef Id="PowerShellFolder">
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
<CreateFolder />
<!-- Work around bug that PowerShell does not always consider default module paths. -->
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[PowerShellFolder]ServiceManagement" System="yes" />
</Component>
<Component Id="AzureSdkShortcutScript" Guid="3d0d589a-b34c-4c48-9a4c-df78f286c6a3">
<File Id="AzureSdkShortcutScriptFile" KeyPath="yes" Source="$(var.SolutionDir)\Setup\ShortcutStartup.ps1" />
</Component>
Expand All @@ -92,15 +88,14 @@
</DirectoryRef>

<Feature Id="azurecmd" Title="Microsoft Azure PowerShell" Level="1" Description="Windows PowerShell commandlets">
<ComponentRef Id="PSModulePath.System" />
<ComponentRef Id="AzureSdkShortcut" />
<ComponentRef Id="AzureSdkShortcutScript" />
</Feature>

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

Expand Down
6 changes: 2 additions & 4 deletions tools/AzureRM/AzureRM.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,15 @@ function Uninstall-AzureRM

Write-Output "Uninstalling AzureRM modules."

$installedModules = Get-InstalledModule

$AzureRMModules.Keys | ForEach {
$moduleName = $_
if (($installedModules | where {$_.Name -eq $moduleName}) -ne $null) {
if ((Get-InstalledModule | where {$_.Name -eq $moduleName}) -ne $null) {
Uninstall-Module -Name $_ -ErrorAction Stop
Write-Output "$moduleName uninstalled..."
}
}

if (($installedModules | where {"AzureRM.Profile" -eq $moduleName}) -ne $null) {
if ((Get-InstalledModule | where {"AzureRM.Profile" -eq $moduleName}) -ne $null) {
Uninstall-Module -Name "AzureRM.Profile" -ErrorAction Stop
Write-Output "AzureRM.Profile uninstalled..."
}
Expand Down