Skip to content

Commit 5291acf

Browse files
added support for proxies (probably)
1 parent 32472e8 commit 5291acf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Install-DbaSSMS.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ function Install-DbaSSMS {
9494
$OutputFile
9595
)
9696
if ($PSCmdlet.ShouldProcess("$ENV:COMPUTERNAME", "Downloading file from $url to $outputFile ")) {
97-
(New-Object System.Net.WebClient).DownloadFile($url, $outputFile)
97+
try {
98+
(New-Object System.Net.WebClient).DownloadFile($url, $outputFile)
99+
}
100+
Catch {
101+
$pscmdlet.WriteVerbose("Probably using a proxy for internet access, trying default proxy settings")
102+
$wc = (New-Object System.Net.WebClient).Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
103+
$wc.DownloadFile($url, $outputFile)
104+
}
98105
}
99106
}
100107

0 commit comments

Comments
 (0)