Skip to content

Instantly share code, notes, and snippets.

@ferventcoder
Created November 30, 2015 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferventcoder/8af7b9100ccccf405a8f to your computer and use it in GitHub Desktop.
Save ferventcoder/8af7b9100ccccf405a8f to your computer and use it in GitHub Desktop.
Get Latest Version of Chocolatey from a NuGet OData Endpoint
$versionUrl = 'http://[NuGetEndpoint]/Packages()?$filter=((Id%20eq%20%27chocolatey%27)%20and%20(not%20IsPrerelease))%20and%20IsLatestVersion'
$downloader = new-object System.Net.WebClient
$downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
Write-Output "Querying latest package from $url"
[xml]$pkg = $downloader.DownloadString($versionUrl)
$latestPackageVersionUrl = $pkg.feed.entry.content.src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment