Skip to content

Commit e2e5828

Browse files
committed
Adding PowerShell and PowerShell ISE Restart actions, fixing module removal script
1 parent c843cca commit e2e5828

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

setup/Setup/RemoveGalleryModules.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ function Remove-Modules
3131

3232
if (Test-Path 'Env:\ProgramFiles(x86)')
3333
{
34-
Remove-Module ([System.IO.Path]::Combine(${env:ProgramFiles(x86)}, "WindowsPowerShell", "Modules"))
34+
Remove-Modules ([System.IO.Path]::Combine(${env:ProgramFiles(x86)}, "WindowsPowerShell", "Modules"))
3535
}
3636

3737
if (Test-Path Env:\ProgramFiles)
3838
{
39-
Remove-Module ([System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules"))
39+
Remove-Modules ([System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules"))
4040
}
4141

setup/azurecmd.wxs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
33

44
<?define productName="Microsoft Azure PowerShell - November 2015" ?>
55
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
@@ -40,6 +40,9 @@
4040
</SetProperty>
4141

4242
<SetProperty Id="POWERSHELLEXE" Value="[WindowsFolder]System32\WindowsPowerShell\v1.0\powershell.exe" Before="AppSearch"/>
43+
44+
<util:CloseApplication Id="ClosePowerShellExe" Target="powershell.exe" ElevatedCloseMessage="yes" CloseMessage="yes" PromptToContinue="yes" Description="PowerShell must be closed to continue with this installation. Please close any PowerShell windows and click 'Retry', or click 'Cancel' to stop installation. If you click 'Ignore' the installer will attempt to close any open PowerShell window."/>
45+
<util:CloseApplication Id="ClosePowerShellIseExe" Target="powershell_ise.exe" ElevatedCloseMessage="yes" CloseMessage="yes" PromptToContinue="yes" Description="PowerShell ISE must be closed to continue with this installation. Please close any PowerShell ISE windows and click 'Retry', or click 'Cancel' to stop installation. If you click 'Ignore' the installer will attempt to close any open PowerShell ISE window."/>
4346

4447
<Condition Message="This setup requires the Windows PowerShell 3.0 or compatible version to be installed.">
4548
<!-- This condition will break if PowerShell has version x3.0 and it is not compatible with 3.0 -->
@@ -119,8 +122,8 @@
119122
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
120123
<CustomAction Id="SetCustomActionDataValue" Return="check" Property="UpdatePSShortcut"
121124
Value="ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" />
122-
<CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -ExecutionPolicy Bypass -Command &quot;. \&quot;[PowerShellFolder]SetExecutionPolicy.ps1\&quot;&quot;" Execute="deferred" Impersonate="no" Return="check"/>
123-
<CustomAction Id="RemoveGalleryModules" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -ExecutionPolicy Bypass -Command &quot;. \&quot;[PowerShellFolder]RemoveGalleryModules.ps1\&quot;&quot;" Execute="deferred" Impersonate="no" Return="check"/>
125+
<CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -Command &quot;. \&quot;[PowerShellFolder]SetExecutionPolicy.ps1\&quot;&quot;" Execute="deferred" Impersonate="no" Return="check"/>
126+
<CustomAction Id="RemoveGalleryModules" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -Command &quot;. \&quot;[PowerShellFolder]RemoveGalleryModules.ps1\&quot;&quot;" Execute="deferred" Impersonate="no" Return="check"/>
124127

125128
<InstallExecuteSequence>
126129
<Custom Action="SetCustomActionDataValue" After="CreateShortcuts">NOT Installed</Custom>

0 commit comments

Comments
 (0)