Skip to content

Instantly share code, notes, and snippets.

@dazinator
Forked from dstockhammer/unlist-packages.ps1
Last active June 10, 2020 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dazinator/172b5c6f365274e4d31bd3e49a89b913 to your computer and use it in GitHub Desktop.
Save dazinator/172b5c6f365274e4d31bd3e49a89b913 to your computer and use it in GitHub Desktop.
Unlist all versions of a NuGet package
choco install nuget.commandline
$PackageId = "xxx"
$ApiKey = "yyy"
$json = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/$PackageId/index.json" | ConvertFrom-Json
foreach($version in $json.versions)
{
Write-Host "Unlisting $PackageId, Ver $version"
Invoke-Expression "nuget.exe delete $PackageId $version $ApiKey -source https://api.nuget.org/v3/index.json -NonInteractive"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment