Skip to content

Commit e54f8a6

Browse files
author
Ben Reader
committed
adding BitsTransfer & user switch
1 parent 9a41c99 commit e54f8a6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scripts/Install-VSCode.ps1

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
A validated string defining which build edition or "stream" to download - stable or
5757
insiders edition. If the parameter is not used, then stable is downloaded as default.
5858
59+
.PARAMETER User
60+
When present, the latest VSCode "User Profile" Insider Edition will be installed.
61+
if BuildEdition is set to "stable" this will revert back to the current standard.
62+
5963
.PARAMETER AdditionalExtensions
6064
An array of strings that are the fully-qualified names of extensions to be
6165
installed in addition to the PowerShell extension. The fully qualified
@@ -122,6 +126,10 @@ param(
122126
[ValidateSet("stable","insider")]
123127
[string]$BuildEdition = "stable",
124128

129+
[Parameter()]
130+
[switch]
131+
$User,
132+
125133
[Parameter()]
126134
[ValidateNotNull()]
127135
[string[]]$AdditionalExtensions = @(),
@@ -167,13 +175,21 @@ if (!($IsLinux -or $IsOSX)) {
167175
break;
168176
}
169177
}
178+
if (($User -eq $true) -and ($BuildEdition -eq "Insider")) {
179+
$codeCmdPath = "$env:LocalAppData\Programs\Microsoft VS Code Insiders\bin\code-insiders.cmd"
180+
$appName = "Visual Studio Code - Insiders Edition ($($Architecture) - User)"
181+
$fileUri = "https://vscode-update.azurewebsites.net/latest/$($bitVersion)-user/$($BuildEdition)"
182+
}
183+
else {
184+
$fileUri = "https://vscode-update.azurewebsites.net/latest/$($bitVersion)/$($BuildEdition)"
185+
}
170186
try {
171187
$ProgressPreference = 'SilentlyContinue'
172188

173189
if (!(Test-Path $codeCmdPath)) {
174190
Write-Host "`nDownloading latest $appName..." -ForegroundColor Yellow
175191
Remove-Item -Force "$env:TEMP\vscode-$($BuildEdition).exe" -ErrorAction SilentlyContinue
176-
Invoke-WebRequest -Uri "https://vscode-update.azurewebsites.net/latest/$($bitVersion)/$($BuildEdition)" -OutFile "$env:TEMP\vscode-$($BuildEdition).exe"
192+
Start-BitsTransfer $fileUri -Destination "$env:TEMP\vscode-$($BuildEdition).exe"
177193

178194
Write-Host "`nInstalling $appName..." -ForegroundColor Yellow
179195
Start-Process -Wait "$env:TEMP\vscode-$($BuildEdition).exe" -ArgumentList /silent, /mergetasks=!runcode

0 commit comments

Comments
 (0)