Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

(unofficial) Chocolatey Package Deprecater/Retirer (Script)

  • 1
  • 2
  • 3

2022.03.15 | Updated: 16 Mar 2022



Downloads of v 2022.03.15:



Software Author(s):

  • Bill Curran

(unofficial) Chocolatey Package Deprecater/Retirer (Script) 2022.03.15

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests

Validation Testing Passed

Verification Testing Passed


Scan Testing Successful:

No detections found in any package files

Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install (unofficial) Chocolatey Package Deprecater/Retirer (Script), run the following command from the command line or from PowerShell:


To upgrade (unofficial) Chocolatey Package Deprecater/Retirer (Script), run the following command from the command line or from PowerShell:


To uninstall (unofficial) Chocolatey Package Deprecater/Retirer (Script), run the following command from the command line or from PowerShell:


Deployment Method:


This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)

2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade choco-package-deprecater -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:

choco upgrade choco-package-deprecater -y --source="'INTERNAL REPO URL'" 

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0

Exit $exitCode

- name: Install choco-package-deprecater
    name: choco-package-deprecater
    version: '2022.03.15'
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.

chocolatey_package 'choco-package-deprecater' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '2022.03.15'

See docs at https://docs.chef.io/resource_chocolatey_package.html.

cChocoPackageInstaller choco-package-deprecater
    Name     = "choco-package-deprecater"
    Version  = "2022.03.15"
    Source   = "INTERNAL REPO URL"

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.

package { 'choco-package-deprecater':
  ensure   => '2022.03.15',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.

4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator virtualex on 16 Mar 2022.



To use choco:// protocol URLs, install (unofficial) choco:// Protocol support

Screenshot of (unofficial) Chocolatey Package Deprecater/Retirer (Script)

choco-package-deprecater (CDEPRECATE) is a PowerShell script I designed for Chocolatey package maintainers/creators to easily deprecate or retire a package. Probably not something you have to do often but CDEPRECATE will save you the time of finding and re-reading the Chocolatey docs.


  • CDEPRECATE rewrites a .nuspec file modifying it ready for deprecation or retirement.
  • CDEPRECATE backups up your original .nuspec file, always!
  • CDEPRECATE will create the necessary chocolateyInstall.ps1 for retired packages.
  • CDEPRECATE can add a "cute" iconUrl.

Helps make packaging Chocolateasy!


  • CDEPRECATE -help for help with options and switches


If you find choco-package-deprecater useful please consider donating: https://www.paypal.me/bcurran3donations or become a patron at https://www.patreon.com/bcurran3

<?xml version="1.0"?>
    <DeprecatedDescription>## This package has been deprecated. It has been replaced by the dependency shown below.</DeprecatedDescription>
    <RetiredDescription>## This package has been retired.</RetiredDescription>

choco-package-deprecater.config preferences notes:

DeprecatedDescription - Custom nuspec description for deprecattion.
DeprecatedIconUrl     - Custom URL to image to use for deprecattion.
RetiredDescription    - Custom nuspec description for retirement.
RetiredIconUrl        - Custom URL to image to use for retirement.

param ([string]$Path=(Get-Location).path)
$ErrorActionPreference = 'Stop'
# cdeprecate.ps1 Copyleft 2019-2022 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues if you have suggestions for improvement.

# REF: https://docs.microsoft.com/en-us/nuget/reference/nuspec
# REF: https://chocolatey.org/docs/how-to-deprecate-a-chocolatey-package
# REF: https://github.com/chocolatey/choco-wiki/issues/109
# REF: https://github.com/chocolatey/choco-wiki/issues/110

Write-Host "cdeprecate.ps1 v2022.03.15 - (unofficial) Chocolatey Package Deprecater/Retirer" -Foreground White
Write-Host "Copyleft 2019-2022 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White

$PSDefaultParameterValues['*:Encoding'] = 'utf8'
$scriptDir      = "$env:ChocolateyToolsLocation\BCURRAN3"
$ScriptConfig   = 'cdeprecate.config'

# Verify ChocolateyToolsLocation was created by Get-ToolsLocation during install and is in the environment
If (!($env:ChocolateyToolsLocation)) {$env:ChocolateyToolsLocation = "$env:SystemDrive\tools"}

if (($args -eq '-help') -or ($args -eq '-?') -or (!$args)) {
    Write-Host "OPTIONS AND SWITCHES:" -Foreground Magenta
	Write-Host "-help, -?"
	Write-Host "   Displays this information."
	Write-Host "-Deprecate"
	Write-Host "   Deprecate the package."
	Write-Host "-Retire"
	Write-Host "   Retire the package."
	Write-Host "-AddDependency"
	Write-Host "   Not implemented yet."
	Write-Host "-AddIcon"
	Write-Host "   Add a fun icon instead of boring no icon."
	Write-Host "-EditConfig"
	Write-Host "   Edit cdeprecate config file."
	Write-Host "-OpenDeprecateDocs"
	Write-Host "   Opens https://chocolatey.org/docs/how-to-deprecate-a-chocolatey-package in your default browser."

# Setup conditions
if ($args -eq "-Deprecate") {$Deprecate=$True} else {$Deprecate=$False}
if ($args -eq "-Retire") {$Retire=$True} else {$Retire=$False}
if ($args -eq "-AddDependency") {$AddDependency=$True} else {$AddDependency=$False}
if ($args -eq "-AddIcon") {$AddIcon=$True} else {$AddIcon=$False}
if ($args -eq "-Debug") {$Debug=$True} else {$Debug=$False}
If (Test-Path $env:ChocolateyInstall\bin\notepad++.exe){$Editor="notepad++.exe" } else {$Editor="notepad.exe"}
If ($args -eq "-EditConfig") {
    Write-Host "  ** Editing contents of $ScriptConfig." -Foreground Magenta
	&$Editor "$scriptDir\$ScriptConfig"
if ($args -eq "-OpenDeprecateDocs") {&start https://docs.chocolatey.org/en-us/community-repository/maintainers/deprecate-a-chocolatey-package ; return }

# Set default preferences incase of corrupt or missing cdeprecate.config
$DeprecatedDescription = '## This package has been deprecated. It has been replaced by the dependency shown below.'
$DeprecatedIconUrl     = 'https://cdn.staticaly.com/gh/bcurran3/ChocolateyPackages/master/mylogos/deprecated.png'
$RetiredDescription    = '## This package has been retired.'
$RetiredIconUrl        = 'https://cdn.staticaly.com/gh/bcurran3/ChocolateyPackages/master/mylogos/retired.png'

# Import preferences - see comments in cdeprecate.config for settings
If (Test-Path "$scriptDir\$ScriptConfig") {
   [xml]$ConfigFile       = Get-Content "$scriptDir\$ScriptConfig"
   $DeprecatedDescription = $ConfigFile.Settings.Preferences.DeprecatedDescription
   $DeprecatedIconUrl     = $ConfigFile.Settings.Preferences.DeprecatedIconUrl
   $RetiredDescription    = $ConfigFile.Settings.Preferences.RetiredDescription
   $RetiredIconUrl        = $ConfigFile.Settings.Preferences.RetiredIconUrl
   } else { 
   Write-Warning "   ** $ScriptConfig not found, using defaults."

# Finds nuspec file for processing. Defaults to current working directory.
# You can specify a directory path, but do NOT specify the file itself, just the directory.
#if (!$path) {$LocalnuspecFile = Get-Item -Path $path\*.nuspec}
if ($path -eq "\"){$path=(Get-Location).Drive.Name + ":" + "\"}
if (!(Test-Path $path)){Write-Host "           ** $path is an invalid path." -Foreground Red; return}
if ($path) {$LocalnuspecFile = Get-Item $path\*.nuspec}
if (!($LocalnuspecFile)) {
    Write-Host "           ** No .nuspec file found in $path" -Foreground Red
if ($LocalnuspecFile.count -gt 1){
    Write-Host "           ** Multiple .nuspec files found in $path. Please delete or rename the extras." -Foreground Red

# Import package.nuspec file to get values
$nuspecXML = $LocalnuspecFile
[xml]$nuspecFile = Get-Content $nuspecXML
$NuspecAuthors = $nuspecFile.package.metadata.authors
$NuspecBugTrackerURL = $nuspecFile.package.metadata.bugtrackerurl	
#$NuspecConflicts = $nuspecFile.package.metadata.conflicts # Built for the future
$NuspecCopyright = $nuspecFile.package.metadata.copyright
$NuspecDependencies = $nuspecFile.package.metadata.dependencies
$NuspecDescription = $nuspecFile.package.metadata.description
$NuspecDocsURL = $nuspecFile.package.metadata.docsurl
$NuspecFiles = $nuspecFile.package.files.file
$NuspecIconURL = $nuspecFile.package.metadata.iconurl
$NuspecID = $nuspecFile.package.metadata.id
$NuspecLicenseURL = $nuspecFile.package.metadata.licenseurl
$NuspecMailingListURL = $nuspecFile.package.metadata.mailinglisturl
$NuspecOwners = $nuspecFile.package.metadata.owners
$NuspecPackageSourceURL = $nuspecFile.package.metadata.packagesourceurl
$NuspecProjectSourceURL = $nuspecFile.package.metadata.projectsourceurl
$NuspecProjectURL = $nuspecFile.package.metadata.projecturl
#$NuspecProvides = $nuspecFile.package.metadata.provides # Built for the future
$NuspecReleaseNotes = $nuspecFile.package.metadata.releasenotes
#$NuspecReplaces = $nuspecFile.package.metadata.replaces # Built for the future
$NuspecRequireLicenseAcceptance = $nuspecFile.package.metadata.requireLicenseAcceptance
$NuspecSummary = $nuspecFile.package.metadata.summary
$NuspecTags = $nuspecFile.package.metadata.tags
$NuspecTitle = $nuspecFile.package.metadata.title
$NuspecVersion = $nuspecFile.package.metadata.version
#$NuspecXMLComment = $nuspecFile.'#comment'
#$NuspecXMLNamespace = $nuspecFile.package.xmlns


if ($debug){
	Write-Host "Path equals $path"
	Write-Host "LocalnuspecFile equals $LocalnuspecFile"
	Write-Host "nuspecXML equals $nuspecXML"
	Write-Host "NuspecTitle equals $NuspecTitle"
	Write-Host "nuspecFile.package.metadata.requireLicenseAcceptance equals $nuspecFile.package.metadata.requireLicenseAcceptance"
	Write-Host "NuspecRequireLicenseAcceptance equals $NuspecRequireLicenseAcceptance"

if ($deprecate) {Write-Host "Deprecating $NuspecDisplayName`:" -Foreground Magenta}
if ($retire){Write-Host "Retiring $NuspecDisplayName`:" -Foreground Magenta}

# Update the nuspec with changes and save as UTF-8 w/o BOM # Thanks https://stackoverflow.com/questions/8160613/powershell-saving-xml-and-preserving-format
Function Update-nuspec{
      $UpdatednuspecFile = [xml]([System.IO.File]::ReadAllText($LocalnuspecFile))
      $UpdatednuspecFile.PreserveWhitespace = $true
      $settings = New-Object System.Xml.XmlWriterSettings
      $settings.Indent = $true
      $settings.NewLineChars ="`r`n"
      $settings.Encoding = New-Object System.Text.UTF8Encoding($false)   

# Don't change:

# Changes
if ($NuspecBugTrackerURL) {$UpdatednuspecFile.package.metadata.bugtrackerurl=''}
if ($NuspecCopyright) {$UpdatednuspecFile.package.metadata.copyright=''}
if ($NuspecDependencies){
    if ($deprecate){
        $UpdatednuspecFile.package.metadata.dependencies='Add your superceding package here.'
    if ($retire){
   } else {
     if ($deprecate){
         Write-Host "  ** You need to add a dependency pointing to the replacement package." -Foreground Red
         Write-Host "  ** If there is no replacement package, then retire this package instead of deprecating it." -Foreground Red
if ($deprecate){$UpdatednuspecFile.package.metadata.description=$DeprecatedDescription}
if ($retire){$UpdatednuspecFile.package.metadata.description=$RetiredDescription}
if ($NuspecDocsURL){$UpdatednuspecFile.package.metadata.docsurl=''}
if ($NuspecIconURL){$UpdatednuspecFile.package.metadata.iconurl=''}
if ($deprecate -and $addicon){$UpdatednuspecFile.package.metadata.iconurl=$DeprecatedIconUrl}
if ($retire -and $addicon){$UpdatednuspecFile.package.metadata.iconurl=$RetiredIconUrl}
if ($NuspecLicenseURL) {$UpdatednuspecFile.package.metadata.licenseurl=''}
if ($NuspecRequireLicenseAcceptance) {$UpdatednuspecFile.package.metadata.requireLicenseAcceptance='false'}
if ($NuspecMailingListURL) {$UpdatednuspecFile.package.metadata.mailinglisturl=''}
if ($NuspecProjectSourceURL) {$UpdatednuspecFile.package.metadata.projectsourceurl=''}
if ($NuspecReleaseNotes) {$UpdatednuspecFile.package.metadata.releasenotes=''}
if ($NuspecSummary) {$UpdatednuspecFile.package.metadata.summary=''}
if ($NuspecTags){
     if ($deprecate){$UpdatednuspecFile.package.metadata.tags='deprecated'}
     if ($retire){$UpdatednuspecFile.package.metadata.tags='retired'}
if ($NuspecTitle -notmatch "deprecated" -and $deprecate){$UpdatednuspecFile.package.metadata.title='[DEPRECATED] ' + $NuspecTitle}
if ($NuspecTitle -notmatch "retire" -and $retire){$UpdatednuspecFile.package.metadata.title='[RETIRED] ' + $NuspecTitle}

#TDL: Need to handle <files> still          <<<<<<<<<<<<<---------------------------------------------------------------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#TDL: Need to handle <dependencies> still   <<<<<<<<<<<<<---------------------------------------------------------------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      $xfile = [System.Xml.XmlWriter]::Create($LocalnuspecFile, $settings)
      } finally {

if ($deprecate -or $retire) {
    if (Test-Path $path\$LocalnuspecFile.cdeprecate.bak) {Write-Host "  ** Please delete your current backup before continuing." -Foreground Red ; break} # <<<-- doesn't work for some reason
    Copy-Item "$LocalnuspecFile" "$LocalnuspecFile.cdeprecate.bak" -Force | Out-Null # ALWAYS make backup copy!
    Write-Host "  ** Backup saved to $LocalnuspecFile.cdeprecate.bak." -Foreground Green
	if ($retire){
	    if (!(Test-Path "$path\tools")) {New-Item -Path $path -Name "tools" -ItemType "directory" | Out-Null}
	    Write-Output 'Write-Host ""  ** This package has been retired."" -Foreground Magenta' | Out-File "$path\tools\chocolateyInstall.ps1"
	Write-Host "  ** Done!" -Foreground Green
	} else {
	  Write-Host "  ** Nothing done. You must specify -Deprecate or -Retire." -Foreground Magenta

Write-Host "`nFound cdeprecate.ps1 useful?" -Foreground White
Write-Host "Buy me a beer at https://www.paypal.me/bcurran3donations" -Foreground White
Write-Host "Become a patron at https://www.patreon.com/bcurran3" -Foreground White
if (!(Test-Path "$ENV:ChocolateyToolsLocation\BCURRAN3\CNC.ps1")) {Write-Host "You need CNC! Get it at https://community.chocolatey.org/packages/choco-nuspec-checker" -Foreground Magenta }

# create xml tags that don't exist; i.e. dependencies and files
# add superceding package as a parameter to create the dependency
# clean up pathing
$ErrorActionPreference = 'Stop'
$packageName = 'choco-package-deprecater'
$toolsDir    = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$scriptDir   = "$(Get-ToolsLocation)\BCURRAN3"
$script      = 'cdeprecate.ps1'

# Setup
# New storage location moving forward for all my Chocolatey scripts
if (!(Test-Path "$ENV:ChocolateyToolsLocation\BCURRAN3")) { New-Item -Path "$ENV:ChocolateyToolsLocation" -Name "BCURRAN3" -ItemType "directory" | Out-Null }

# Install
# Move new files and support files (if applicable)
Move-Item "$toolsDir\$script" "$scriptDir" -Force
Install-ChocolateyPowershellCommand -PackageName 'cdeprecate' -PSFileFullPath "$scriptDir\$script"
if (!(Test-Path "$scriptDir\cdeprecate.config")) {Move-Item "$toolsDir\cdeprecate.config" "$scriptDir" -Force} else {Remove-Item "$toolsDir\cdeprecate.config" | Out-Null}

# Cleanup
if ($ENV:Path -NotMatch "BCURRAN3"){ Install-ChocolateyPath "$scriptDir" "Machine" ; refreshenv }
$ErrorActionPreference = 'Stop'
$packageName = 'choco-package-deprecater'
$scriptDir   = "$(Get-ToolsLocation)\BCURRAN3"

Remove-Item "$ENV:ChocolateyInstall\bin\cdeprecate.bat" -Force | Out-Null
Remove-Item "$scriptDir\cdeprecate.*" -Force -ErrorAction SilentlyContinue | Out-Null
if (!(Get-ChildItem -Path "$ENV:ChocolateyToolsLocation\BCURRAN3" | Measure-Object | %{$_.Count})) {
   $ENV:Path.Replace("$ChocolateyToolsLocation\BCURRAN3","") | Out-Null
   Remove-Item "$ENV:ChocolateyToolsLocation\BCURRAN3" | Out-Null

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
(unofficial) Chocolatey Package Deprecater/Retirer (Script) 2019.09.03 963 Tuesday, September 3, 2019 Approved


  • 2022.03.15 - Updated messages with markdown that are incompatible with the Sept. 2019 changes to chocolatey.org, set requireLicenseAcceptance to false to avoid schema error (new behavior?), -addicon will now work if iconUrl was originally blank; changed iconUrl to use CDN URLs, now won't add [DEPRECATED] or [RETIRED] if you run cdeprecate a 2nd time, implemented a config file and defaults, now removes "shim" when uninstalled, updated Chocolatey's DEPRECATE A PACKAGE URL
  • 2019.09.03 - initial release. Does most of what's needed. Finishing touches and improvements to come. MIWMIP - "Make it work. Make it pretty."

This package has no dependencies.

Discussion for the (unofficial) Chocolatey Package Deprecater/Retirer (Script) Package

Ground Rules:

  • This discussion is only about (unofficial) Chocolatey Package Deprecater/Retirer (Script) and the (unofficial) Chocolatey Package Deprecater/Retirer (Script) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or (unofficial) Chocolatey Package Deprecater/Retirer (Script), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus