Skip to content

Instantly share code, notes, and snippets.

@dstockhammer
Last active October 26, 2024 20:35
Show Gist options
  • Save dstockhammer/059d5ef6b9b6b3870e40e75a62a25a4d to your computer and use it in GitHub Desktop.
Save dstockhammer/059d5ef6b9b6b3870e40e75a62a25a4d to your computer and use it in GitHub Desktop.
Unlist all versions of a NuGet package
$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"
}
@fschick
Copy link

fschick commented Sep 16, 2024

The value for PackageId must be entered in lower case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment