Created
July 25, 2011 19:37
-
-
Save chrissie1/1104983 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# variables | |
$url = "http://packages.nuget.org/v1/Package/Download/Chocolatey/0.9.8.4" | |
$chocTempDir = Join-Path $env:TEMP "chocolatey" | |
$tempDir = Join-Path $chocTempDir "chocInstall" | |
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} | |
$file = Join-Path $tempDir "chocolatey.zip" | |
# download the package | |
Write-Host "Downloading $url to $file" | |
$downloader = new-object System.Net.WebClient | |
if (!$downloader.Proxy.IsBypassed($url)) | |
{ | |
$cred = get-credential | |
$webclient = new-object System.Net.WebClient | |
$proxyaddress = $webclient.Proxy.GetProxy($url).Authority | |
Write-host "Using this proxyserver: " $proxyaddress | |
$proxy = New-Object System.Net.WebProxy($proxyaddress) | |
$proxy.credentials = $cred.GetNetworkCredential(); | |
$downloader.proxy = $proxy | |
} | |
$downloader.DownloadFile($url, $file) | |
# unzip the package | |
Write-Host "Extracting $file to $destination..." | |
$shellApplication = new-object -com shell.application | |
$zipPackage = $shellApplication.NameSpace($file) | |
$destinationFolder = $shellApplication.NameSpace($tempDir) | |
$destinationFolder.CopyHere($zipPackage.Items(),0x10) |
It now has no more reference to the server. It should just pick it up if you have it configured. I hope this works for NTML proxies too but not sure.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 14.... does this work without "http://10.6.76.20:8080" ?