Skip to content

Commit 531d084

Browse files
committed
Merge pull request #42 from huangpf/vmss
Vmss
2 parents c984657 + df92ee8 commit 531d084

File tree

729 files changed

+391329
-230207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

729 files changed

+391329
-230207
lines changed

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
14-
[CmdletBinding()]
14+
[CmdletBinding(DefaultParametersetName="none")]
1515
Param(
16-
[Parameter(Mandatory=$False, HelpMessage="Use Install parameter to install Azure modules from PowerShell Gallery.")]
17-
[switch]$Install
16+
[Parameter(Mandatory=$True, HelpMessage="Use Install parameter to install Azure modules from PowerShell Gallery.", ParameterSetName="install")]
17+
[switch]$Install,
18+
[Parameter(Mandatory=$True, HelpMessage="Use Uninstall parameter to uninstall Azure modules from PowerShell Gallery.", ParameterSetName="uninstall")]
19+
[switch]$Uninstall
1820
)
1921

2022
function EnsureRegistryPath
@@ -38,7 +40,7 @@ try {
3840
Write-Output @"
3941
4042
Finalizing installation of Azure PowerShell.
41-
Installing Azure Modules from PowerShell Gallery.
43+
Installing AzureRM Modules from PowerShell Gallery.
4244
This may take some time...
4345
"@
4446
$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
@@ -49,16 +51,47 @@ This may take some time...
4951

5052
Import-Module PowerShellGet
5153

52-
Install-Module AzureRM
53-
Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
54-
Update-AzureRM
55-
} else {
54+
$DefaultPSRepository = $env:DefaultPSRepository
55+
if ([string]::IsNullOrWhiteSpace($DefaultPSRepository))
56+
{
57+
$DefaultPSRepository = "PSGallery"
58+
}
59+
60+
$_InstallationPolicy = (Get-PSRepository -Name $DefaultPSRepository).InstallationPolicy
61+
try
62+
{
63+
Set-PSRepository -Name $DefaultPSRepository -InstallationPolicy Trusted
64+
65+
Install-Module AzureRM -Repository $DefaultPSRepository
66+
Write-Output "AzureRM $((Get-InstalledModule -Name AzureRM)[0].Version) installed..."
67+
68+
Update-AzureRM -Repository $DefaultPSRepository
69+
} finally {
70+
# Clean up
71+
Set-PSRepository -Name $DefaultPSRepository -InstallationPolicy $_InstallationPolicy
72+
}
73+
}
74+
elseif ($Uninstall.IsPresent)
75+
{
76+
Write-Output @"
77+
78+
Finalizing uninstallation of Azure PowerShell.
79+
This may take some time...
80+
"@
81+
$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
82+
83+
Uninstall-AzureRM
84+
Uninstall-Module -Name AzureRM -Confirm:$false -Force
85+
}
86+
else
87+
{
5688
cd c:\
5789
$welcomeMessage = @"
5890
For a list of all Azure RM cmdlets type 'help azurerm'.
5991
6092
To start using Azure RM login via Login-AzureRmAccount cmdlet.
6193
To switch between subscriptions use Set-AzureRmContext.
94+
For more details, see http://aka.ms/azps-getting-started.
6295
6396
To use Azure Service Management cmdlets please execute the following cmdlet:
6497
Install-Module Azure
@@ -73,6 +106,6 @@ catch
73106
Write-Output "An error occured during installation."
74107
Write-Output $error
75108
Write-Output "Press any key..."
76-
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
109+
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
77110
}
78111

setup-powershellget/azurecmd.wxs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,14 @@
9797
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
9898
<CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;Set-ExecutionPolicy RemoteSigned -Force&quot;" Execute="deferred" Impersonate="no" Return="check"/>
9999
<CustomAction Id="RunModuleInstallScript" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;. \&quot;[PowerShellFolder]\ShortcutStartup.ps1\&quot; -Install&quot;" Execute="deferred" Impersonate="no" Return="check"/>
100+
<CustomAction Id="RunModuleUninstallScript" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;. \&quot;[PowerShellFolder]\ShortcutStartup.ps1\&quot; -Uninstall&quot;" Execute="deferred" Impersonate="no" Return="check"/>
100101

101102
<InstallExecuteSequence>
102103
<Custom Action="SetCustomActionDataValue" After="CreateShortcuts">NOT Installed</Custom>
103104
<Custom Action="UpdatePSShortcut" After="SetCustomActionDataValue">NOT Installed</Custom>
104105
<Custom Action="SetExecutionPolicy" After="UpdatePSShortcut">NOT Installed</Custom>
105106
<Custom Action="RunModuleInstallScript" After="SetExecutionPolicy">NOT Installed</Custom>
107+
<Custom Action="RunModuleUninstallScript" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
106108
</InstallExecuteSequence>
107109

108110
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\media\License.rtf" />

0 commit comments

Comments
 (0)