Skip to content

Instantly share code, notes, and snippets.

View bevand's full-sized avatar

Bevan Dunning bevand

  • Auckland, New Zealand
View GitHub Profile
@bevand
bevand / ps-push-all-nuget-packages
Created January 7, 2017 03:47
Powershell push all packages from local folder
#add source
nuget sources Add -Name "custom-feed" -Source "https://newhostednugetfeed.com/custom-feed/nuget/v3/index.json" -username
USERNAME -password PASSWORD
$files = Get-ChildItem C:\LocalNuGetTest\*.nupkg
ForEach ($file in $files) {
#echo $file.fullName
nuget push -Source "custom-feed" -ApiKey VSTS $file.fullName
}
@bevand
bevand / ps-download-all-nuget-packages
Last active March 19, 2024 23:25
Powershell script to download all packages from a nuget feed
$destinationDirectory = "C:\LocalNuGetTest\"
$webClient = New-Object System.Net.WebClient
$webClient.Credentials = New-Object System.Net.NetworkCredential("USERNAME", "PASSWORD")
$feed =[xml]$webClient.DownloadString("https://hostednugetfeed.com/custom-feed/nuget/v2/Packages")
$records = $feed | select -ExpandProperty feed | select -ExpandProperty entry #| select -ExpandProperty content
for ($i=0; $i -lt $records.Length; $i++) {
$content = $records[$i] | select -ExpandProperty content
$properties = $records[$i] | select -ExpandProperty properties