Downloads of v 2019.09.03:


Last Update:

03 Sep 2019

Package Maintainer(s):

Software Author(s):

  • Bill Curran


bcurran3 cdeprecate choco unofficial package deprecate retire script chocolateasy

(unofficial) Chocolatey Package Deprecater/Retirer (Script)

  • 1
  • 2
  • 3

2019.09.03 | Updated: 03 Sep 2019



Downloads of v 2019.09.03:



Software Author(s):

  • Bill Curran

  • 1
  • 2
  • 3
(unofficial) Chocolatey Package Deprecater/Retirer (Script) 2019.09.03

  • 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


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:


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

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • 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 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. Enter your internal repository url

(this should look similar to

4. Choose your deployment method:

choco upgrade choco-package-deprecater -y --source="'STEP 3 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="'STEP 3 URL'"

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

Exit $exitCode

- name: Ensure choco-package-deprecater installed
    name: choco-package-deprecater
    state: present
    version: 2019.09.03
    source: STEP 3 URL

See docs at

chocolatey_package 'choco-package-deprecater' do
  action    :install
  version  '2019.09.03'
  source   'STEP 3 URL'

See docs at

    Name: choco-package-deprecater,
    Version: 2019.09.03,
    Source: STEP 3 URL

Requires Otter Chocolatey Extension. See docs at

cChocoPackageInstaller choco-package-deprecater
   Name     = 'choco-package-deprecater'
   Ensure   = 'Present'
   Version  = '2019.09.03'
   Source   = 'STEP 3 URL'

Requires cChoco DSC Resource. See docs at

package { 'choco-package-deprecater':
  provider => 'chocolatey',
  ensure   => '2019.09.03',
  source   => 'STEP 3 URL',

Requires Puppet Chocolatey Provider module. See docs at

salt '*' chocolatey.install choco-package-deprecater version="2019.09.03" source="STEP 3 URL"

See docs at

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved by moderator gep13 on 04 Sep 2019.



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 having to look up what you need to do to your .nuspec file.


  • 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: or become a patron at

<?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 - 
DeprecatedIconUrl     - 
RetiredDescription    - 
RetiredIconUrl        - 

# cdeprecate.ps1 Copyleft 2019 by Bill Curran AKA BCURRAN3
# Open a GitHub issue at if you have suggestions for improvement.

# REF:
# REF:
# REF:
# REF:

param (

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

$ErrorActionPreference = 'Stop'
$PSDefaultParameterValues['*:Encoding'] = 'utf8'

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 "-AddIcon"
	Write-Host "   Add a fun icon instead of no icon."
	Write-Host "-EditConfig"
	Write-Host "   Edit cdeprecate config file."
	Write-Host "-OpenDeprecateDocs"
	Write-Host "   Opens in your default browser."

if ($args -eq "-Deprecate") {$Deprecate=$True} else {$Deprecate=$False}
if ($args -eq "-Retire") {$Retire=$True} else {$Retire=$False}
if ($args -eq "-AddIcon") {$AddIcon=$True} else {$AddIcon=$False}
if ($args -eq "-Debug") {$Debug=$True} else {$Debug=$False}
if ($args -eq "-EditConfig") {
    Write-Host "  ** Editing contents of $ENV:ChocolateyToolsLocation\BCURRAN3\cdeprecate.config." -Foreground Magenta
    if (Test-Path $ENV:ChocolateyInstall\bin\notepad++.exe){$Editor="notepad++.exe"} else {$Editor="notepad.exe"}
	&$Editor "$ENV:ChocolateyToolsLocation\BCURRAN3\cdeprecate.config"
if ($args -eq "-OpenDeprecateDocs") {&start ; return }

if ($path -eq "\"){
    $path=(Get-Location).Drive.Name + ":" + "\"

if (!(Test-Path $path)){
    Write-Host "           ** $path is an invalid path." -Foreground Red

# 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) {$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 remove 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 = $
$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 ($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
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='##This package has been deprecated. It has been replaced by the dependency shown below.'}
if ($retire){$UpdatednuspecFile.package.metadata.description='##This package has been retired.'}
if ($NuspecDocsURL){$UpdatednuspecFile.package.metadata.docsurl=''}
if ($NuspecIconURL){
    if ($deprecate -and $addicon){$UpdatednuspecFile.package.metadata.iconurl=''}
    if ($retire -and $addicon){$UpdatednuspecFile.package.metadata.iconurl=''}
if ($NuspecLicenseURL) {$UpdatednuspecFile.package.metadata.licenseurl=''}
if ($NuspecMailingListURL) {$UpdatednuspecFile.package.metadata.mailinglisturl=''}
if ($NuspecProjectSourceURL) {$UpdatednuspecFile.package.metadata.projectsourceurl=''}
if ($NuspecReleaseNotes) {$UpdatednuspecFile.package.metadata.releasenotes=''}
if ($NuspecRequireLicenseAcceptance) {$UpdatednuspecFile.package.metadata.requirelicenseacceptance=''}
if ($NuspecSummary) {$UpdatednuspecFile.package.metadata.summary=''}
if ($NuspecTags){
     if ($deprecate){$UpdatednuspecFile.package.metadata.tags='deprecated'}
     if ($retire){$UpdatednuspecFile.package.metadata.tags='retired'}
#TDL: Add checking so deprecated/retired doesn't get added twice
if ($deprecate){$UpdatednuspecFile.package.metadata.title='[DEPRECATED] ' + $NuspecTitle}
if ($retire){$UpdatednuspecFile.package.metadata.title='[RETIRED] ' + $NuspecTitle}
#TDL: Need to handle <files> still                                        <<<<<<<<<<<<<---------------------------------------------------------------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      $xfile = [System.Xml.XmlWriter]::Create($LocalnuspecFile, $settings)
      } finally {

if ($debug) {
Write-Host "  ** DEBUG: path=$path" -Foreground Cyan
Write-Host "  ** DEBUG: LocalnuspecFile=$LocalnuspecFile" -Foreground Cyan
Write-Host "  ** DEBUG: LocalnuspecFile.cdeprecate.bak=$LocalnuspecFile.cdeprecate.bak" -Foreground Cyan
Write-Host "  ** DEBUG: test-path result = $((Test-Path $path\$LocalnuspecFile.cdeprecate.bak))" -Foreground Cyan

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" -Foreground White
Write-Host "Become a patron at" -Foreground White
if (!(Test-Path "$ENV:ChocolateyToolsLocation\BCURRAN3\CNC.ps1")) {Write-Host "You need CNC!" -Foreground Magenta }

# check deprecated/retired title prefacing so it's not duplicated
# -addicon doesn't work if iconurl is originally blank
# create tags that don't exist; i.e. dependencies
# create files tag if it doesn't exisit
# add superceding package as a parameter to create the dependency
# find and kill get-object display at end of script (??????????????????????????)
# 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 "$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.

Version Downloads Last Updated Status


  • 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