1
1
param (
2
2
[parameter (Position = 0 )]
3
3
[string ] $command ,
4
+ [string ] $proxy ,
4
5
[switch ] $verbosity = $false ,
5
6
[alias (" g" )][switch ] $global = $false ,
6
7
[alias (" p" )][switch ] $persistent = $false ,
@@ -22,16 +23,17 @@ $scriptPath = $myInvocation.MyCommand.Definition
22
23
23
24
function Kvm-Help {
24
25
@"
25
- K Runtime Environment Version Manager - Build 509
26
+ K Runtime Environment Version Manager - Build 538
26
27
27
28
USAGE: kvm <command> [options]
28
29
29
- kvm upgrade [-x86][-x64] [-svr50][-svrc50] [-g|-global]
30
+ kvm upgrade [-x86][-x64] [-svr50][-svrc50] [-g|-global] [-proxy <ADDRESS>]
30
31
install latest KRE from feed
31
32
set 'default' alias to installed version
32
33
add KRE bin to user PATH environment variable
33
34
-g|-global install to machine-wide location
34
35
-f|-force upgrade even if latest is already installed
36
+ -proxy <ADDRESS> use given address as proxy when accessing remote server
35
37
36
38
kvm install <semver>|<alias>|<nupkg> [-x86][-x64] [-svr50][-svrc50] [-g|-global]
37
39
install requested KRE from feed
@@ -124,6 +126,25 @@ function Kvm-Upgrade {
124
126
Kvm- Alias- Set " default" $version
125
127
}
126
128
129
+ function Add-Proxy-If-Specified {
130
+ param (
131
+ [System.Net.WebClient ] $wc
132
+ )
133
+ if (! $proxy ) {
134
+ $proxy = $env: http_proxy
135
+ }
136
+ if ($proxy ) {
137
+ $wp = New-Object System.Net.WebProxy($proxy )
138
+ $pb = New-Object UriBuilder($proxy )
139
+ if (! $pb.UserName ) {
140
+ $wp.Credentials = [System.Net.CredentialCache ]::DefaultCredentials
141
+ } else {
142
+ $wp.Credentials = New-Object System.Net.NetworkCredential($pb.UserName , $pb.Password )
143
+ }
144
+ $wc.Proxy = $wp
145
+ }
146
+ }
147
+
127
148
function Kvm-Find-Latest {
128
149
param (
129
150
[string ] $platform ,
@@ -135,6 +156,7 @@ param(
135
156
136
157
$wc = New-Object System.Net.WebClient
137
158
$wc.Credentials = new-object System.Net.NetworkCredential(" aspnetreadonly" , " 4d8a2d9c-7b80-4162-9978-47e918c9658c" )
159
+ Add-Proxy - If- Specified($wc )
138
160
[xml ]$xml = $wc.DownloadString ($url )
139
161
140
162
$version = Select-Xml " //d:Version" - Namespace @ {d = ' http://schemas.microsoft.com/ado/2007/08/dataservices' } $xml
@@ -181,6 +203,7 @@ param(
181
203
182
204
$wc = New-Object System.Net.WebClient
183
205
$wc.Credentials = new-object System.Net.NetworkCredential(" aspnetreadonly" , " 4d8a2d9c-7b80-4162-9978-47e918c9658c" )
206
+ Add-Proxy - If- Specified($wc )
184
207
$wc.DownloadFile ($url , $tempKreFile )
185
208
186
209
Do - Kvm- Unpack $tempKreFile $kreTempDownload
0 commit comments