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

Downloads:

169,814

Downloads of v 2019.01.24:

782

Last Update:

25 Jan 2019

Package Maintainer(s):

Software Author(s):

  • Bill Curran

Tags:

(unofficial) Choco Package List Backup to Local and Cloud (Script + Task)

This is not the latest version of (unofficial) Choco Package List Backup to Local and Cloud (Script + Task) available.

  • 1
  • 2
  • 3

2019.01.24 | Updated: 25 Jan 2019

Downloads:

169,814

Downloads of v 2019.01.24:

782

Maintainer(s):

Software Author(s):

  • Bill Curran

(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.24

This is not the latest version of (unofficial) Choco Package List Backup to Local and Cloud (Script + Task) available.

Legal Disclaimer: Neither this package nor Chocolatey Software, Inc. are affiliated with or endorsed by Bill Curran. The inclusion of Bill Curran trademark(s), if any, upon this webpage is solely to identify Bill Curran goods or services and not for commercial purposes.

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install (unofficial) Choco Package List Backup to Local and Cloud (Script + Task), run the following command from the command line or from PowerShell:

>

To upgrade (unofficial) Choco Package List Backup to Local and Cloud (Script + Task), run the following command from the command line or from PowerShell:

>

To uninstall (unofficial) Choco Package List Backup to Local and Cloud (Script + Task), run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

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-list-backup -y --source="'INTERNAL REPO URL'" --version="'2019.01.24'" [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-list-backup -y --source="'INTERNAL REPO URL'" --version="'2019.01.24'" 
$exitCode = $LASTEXITCODE

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

Exit $exitCode

- name: Install choco-package-list-backup
  win_chocolatey:
    name: choco-package-list-backup
    version: '2019.01.24'
    source: INTERNAL REPO URL
    state: present

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


chocolatey_package 'choco-package-list-backup' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '2019.01.24'
end

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


cChocoPackageInstaller choco-package-list-backup
{
    Name     = "choco-package-list-backup"
    Version  = "2019.01.24"
    Source   = "INTERNAL REPO URL"
}

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


package { 'choco-package-list-backup':
  ensure   => '2019.01.24',
  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 gep13 on 25 Jan 2019.

Description


choco://choco-package-list-backup
To use choco:// protocol URLs, install (unofficial) choco:// Protocol support


Screenshot of (unofficial) Choco Package List Backup to Local and Cloud (Script)

choco-package-list-backup solves your Chocolatey migration and package re-installation problems!

choco-package-list-backup (CPLB) is a script I wrote that will backup the list of your currently installed Chocolatey packages and save them to a PACKAGES.CONFIG file. You can then use that PACKAGES.CONFIG file to re-install all your packages on another computer or even the same computer later if it crashes. "How can I re-install on the same computer if it crashed and I lost the PACKAGES.CONFIG file?" Thanks for asking! CPLB backs up your package list locally AND to multiple cloud services! But wait, there's more! CPBL also saves your pinned package info. But wait, there's even more! CPBL also saves a list of ALL your programs even if they weren't installed by Chocolatey. Pretty darn cool huh?

FEATURES:

  • CPLB supports saving PACKAGES.CONFIG to all of the following:
    1. your local Documents folder
    2. your Active Directory assigned HOMESHARE
    3. Box
    4. Dropbox Personal and Business
    5. Google Drive and Drive File Stream
    6. iCloudDrive
    7. Microsoft OneDrive
    8. NETGEAR ReadyCLOUD
    9. Nextcloud
    10. ownCloud
    11. Resilio Sync
    12. Seafile
    13. TonidoSync
    14. A custom location of your choice
    15. C:\Users\Public when run from system account
  • CPLB runs on install to make sure you have backup(s) right now!
  • CPLB backups every Monday at 6 AM in the background to C:\Users\Public. Set it and forget it!
  • CPLB supports copying InstChoco - The ULTIMATE Chocolatey and Chocolatey packages (re)installer! to your PACKAGES.CONFIG backup location(s) for the fastest way ever to reinstall Chocolatey and your Chocolatey packages! (Or migrate!)
  • CPLB supports backing up PERSISTENTPACKAGES.CONFIG if you are using Choco Persistent Packages.
  • CPLB integrates with Chocolatey Shortcuts.
  • CPLB saves in computer (name) specific folders so you can backup your Chocolatey package list from multiple computers to the same cloud destination(s). No confusion over what computer gets what packages!
  • CPLB saves a list of all your installed programs (AllProgramsList.txt) whether they were installed by Chocolatey or not.
  • CPLB saves your pinned information to pins.bat for easy re-pinning packages.
  • CPLB is in your path and ready to run.
  • CPLB is configurable. You can:
    1. configure which locations you want or don't want to save to (default=all the locations found except the custom location)
    2. configure to save package version information or not (default=false)
    3. configure to append a date to the saved packages.config and AllProgramsList.txt files(default=false)
    4. configure what folder to save to (default=ChocolateyPackageListBackup)
    5. easily add a custom location by editing CustomPath and UseCustomPath in the .xml configuration file
    6. configure to save a list of all your installed Windows programs whether installed by Chocolatey or not to AllProgramsList.txt (default=true)

If you find choco-package-list-backup useful, and I suspect you will, please consider donating: https://www.paypal.me/bcurran3donations or become a patron at https://www.patreon.com/bcurran3


tools\.SkipAutoUninstaller
 
tools\choco-package-list-backup-manual.bat
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -Command %ChocolateyInstall%\bin\choco-package-list-backup.ps1


tools\choco-package-list-backup.ico
 
tools\choco-package-list-backup.ps1
# choco-package-list-backup.ps1 (to local and cloud) by Bill Curran
# I couldn't have done this without the list parsing from Ammaar Limbada found at https://gist.github.com/alimbada/449ddf65b4ef9752eff3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# ROADMAP:
# Add other cloud services support by request
# Save --packageparameters
# Open to suggestions - open a GitHub issue please if you have a suggestion/request.

Write-Host "choco-package-list-backup.ps1 v2019.01.24 - backup Chocolatey package list locally and to the cloud" -Foreground White
Write-Host "Copyleft 2017-2019 Bill Curran ([email protected]) - free for personal and commercial use" -Foreground White
Write-Host
Write-Host "Choco Package List Backup Summary:" -Foreground Magenta

$Date = Get-Date -UFormat %Y-%m-%d
$ICinstalled = Test-Path "$ENV:ChocolateyInstall\lib\instchoco\tools\InstChoco.exe"
$PinnedPackages=choco pin list -r
$PinnedPackagesFile = "pins.bat"
$PPCinstalled = Test-Path $ENV:ChocolateyInstall\config\persistentpackages.config

# Import preferences - see choco-package-list-backup.xml in Chocolatey's bin dir
[xml]$ConfigFile = Get-Content "$ENV:ChocolateyInstall\bin\choco-package-list-backup.xml"
$PackagesListFile = $ConfigFile.Settings.Preferences.PackagesListFile
$SaveFolderName = $ConfigFile.Settings.Preferences.SaveFolderName
$SaveVersions = $ConfigFile.Settings.Preferences.SaveVersions
$AppendDate = $ConfigFile.Settings.Preferences.AppendDate
$CustomPath = $ConfigFile.Settings.Preferences.CustomPath
$SaveAllProgramsList = $ConfigFile.Settings.Preferences.SaveAllProgramsList
$AllProgramsListFile = $ConfigFile.Settings.Preferences.AllProgramsListFile

$UseCustomPath = $ConfigFile.Settings.Preferences.UseCustomPath 
$UseDocuments = $ConfigFile.Settings.Preferences.UseDocuments
$UseHomeShare = $ConfigFile.Settings.Preferences.UseHomeShare 
$UseBox = $ConfigFile.Settings.Preferences.UseBox
$UseDropbox = $ConfigFile.Settings.Preferences.UseDropbox
$UseGoogleDrive = $ConfigFile.Settings.Preferences.UseGoogleDrive
$UseiCloudDrive = $ConfigFile.Settings.Preferences.UseiCloudDrive
$UseNextcloud = $ConfigFile.Settings.Preferences.UseNextcloud
$UseOneDrive = $ConfigFile.Settings.Preferences.UseOneDrive
$UseownCloud = $ConfigFile.Settings.Preferences.UseownCloud
$UseReadyCLOUD = $ConfigFile.Settings.Preferences.UseReadyCLOUD
$UseResilioSync = $ConfigFile.Settings.Preferences.UseResilioSync
$UseSeafile = $ConfigFile.Settings.Preferences.UseSeafile
$UseTonidoSync = $ConfigFile.Settings.Preferences.UseTonidoSync

if ($AppendDate -eq "true"){
    if ($PackagesListFile -eq "packages.config"){
		 $PackagesListArchival = "packages_$Date.config"
		} else {
		  $PackagesListArchival = $PackagesListFile+"_$Date.config"
		}
 }

# Check the path to save packages.config and create if it doesn't exist
Function Check-SaveLocation{
    $CheckPath = Test-Path $SavePath
  If ($CheckPath -match "False")
     {
      New-Item $SavePath -Type Directory -force | out-null
     }   
    }

# Copy persistentpackages.config if it exists to the same location as packages.config
Function Copy-PPConfig{
   Copy-Item $ENV:ChocolateyInstall\config\persistentpackages.config $SavePath -force | out-null
   Write-Host "  ** $SavePath\persistentpackages.config SAVED!" -Foreground Green 
  }
	
# Copy InstChoco.exe if it exists to the same location as packages.config for super duper easy re-installation
Function Copy-InstChoco{
    $InstChoco = "$ENV:ChocolateyInstall\lib\instchoco\tools\InstChoco.exe" # location of InstChoco.exe if it exists
    $CheckICDest = Test-Path $SavePath\InstChoco.exe
    If ($CheckICDest -match "False")
       {
        Copy-Item $InstChoco $SavePath -force | out-null
        Write-Host "  ** $SavePath\InstChoco.exe SAVED!" -Foreground Green 
	   } else {
	     $ICSource = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($InstChoco).FileVersion
	     $ICDest = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$SavePath\InstChoco.exe").FileVersion
	     if ($ICSource -ne $ICDest)
	        {
	         Copy-Item $InstChoco $SavePath -force | out-null
	         Write-Host "  ** $SavePath\InstChoco.exe COPIED!" -Foreground Green
	        }
	   }
  }

# Write out the saved list of ALL installed programs to AllProgramsList.txt
Function Write-AllProgramsList{
    Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher | Format-Table >"$SavePath\$AllProgramsListFile"
    Write-Host "  ** $SavePath\$AllProgramsListFile SAVED!" -Foreground Green

# 2nd copy in format AllProgramsList_date.txt if AppendDate is set to true	
    if ($AppendDate -eq "true"){
	    $AllProgramsListFileArchival = $AllProgramsListFile.Replace(".txt","")+"_$Date.txt"
        Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher | Format-Table >$SavePath\$AllProgramsListFileArchival
        Write-Host "  ** $SavePath\$AllProgramsListFileArchival SAVED!" -Foreground Green
       }
}  

# Write out pins.bat to easily re-pin previously pinned packages
Function Write-PinnedList{
    Write-Output "@echo off`nrem pinned packages found by choco-package-list-backup.ps1 on $Date :`necho   ** Re-pinning previously pinned Chocolatey packages." | Set-Content -Path "$SavePath\$PinnedPackagesFile"
	if ($SaveVersions -match "True")
	   {
        choco pin list -r | % {"choco pin add -n=$($_.SubString(0, $_.IndexOf("|"))) --version $($_.SubString($_.IndexOf("|") + 1))"} | Add-Content "$SavePath\$PinnedPackagesFile"
	   } else {
         choco pin list -r | % {"choco pin add -n=$($_.SubString(0, $_.IndexOf("|")))"} | Add-Content "$SavePath\$PinnedPackagesFile"
		}
	Write-Host "  ** $SavePath\$PinnedPackagesFile SAVED!" -Foreground Green
	}
  
# Write out the saved list of packages to packages.config
Function Write-PackagesConfig{
    Check-SaveLocation
    Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>`n<packages>" | Set-Content -Path "$SavePath\$PackagesListFile"
	if ($SaveVersions -match "True")
	   {
        choco list -lo -r -y | % { "   <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" } | Add-Content "$SavePath\$PackagesListFile"
	   } else {
         choco list -lo -r -y | % { "   <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" />" } | Add-Content "$SavePath\$PackagesListFile"
		}
    "</packages>" | Add-Content "$SavePath\$PackagesListFile"
	Write-Host "  ** $SavePath\$PackagesListFile SAVED!" -Foreground Green

# 2nd copy in format packages.config_date.config if AppendDate is set to true	
	if ($AppendDate -eq "true"){
    Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>`n<packages>" | Set-Content -Path "$SavePath\$PackagesListArchival"
	    if ($SaveVersions -match "True")
	       {
            choco list -lo -r -y | % { "   <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" } | Add-Content "$SavePath\$PackagesListArchival"
	       } else {
             choco list -lo -r -y | % { "   <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" />" } | Add-Content "$SavePath\$PackagesListArchival"
		    }
    "</packages>" | Add-Content "$SavePath\$PackagesListArchival"
	    Write-Host "  ** $SavePath\$PackagesListArchival SAVED!" -Foreground Green 
    }
	
	if ($PPCinstalled) {Copy-PPConfig}
	if ($SaveAllProgramsList -eq "true"){Write-AllProgramsList}
	if (!$PinnedPackages){Remove-Item "$SavePath\$PinnedPackagesFile" -ea SilentlyContinue | Out-Null }
	if ($PinnedPackages){Write-PinnedList}
	if ($ICinstalled) {Copy-InstChoco}
	Write-Host
}

# Backup Chocolatey package names to packages.config file in custom defined path you set as CustomPath in XLM config file
if ($UseCustomPath -match "True" -and (Test-Path $CustomPath))
   {
    $SavePath   = "$CustomPath\$SaveFolderName"
    Write-PackagesConfig
   }
	
# Backup Chocolatey package names on local computer to packages.config file in the Documents folder
$DocumentsFolder = [Environment]::GetFolderPath("MyDocuments")
if ($DocumentsFolder -ne ""){
   if ($UseDocuments -match "True" -and (Test-Path $DocumentsFolder))
       {
        $SavePath   = "$DocumentsFolder\$SaveFolderName"
        Write-PackagesConfig
       }
   } 
   
# Backup Chocolatey package names on local computer to packages.config file in Box (Sync) directory if it exists
if ($UseBox -match "True" -and (Test-Path "$ENV:USERPROFILE\Box Sync"))
   {
    $SavePath = "$ENV:USERPROFILE\Box Sync\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }    
   
# Check for Dropbox personal and business paths (Thanks ebbek!)
if (Test-Path $ENV:AppData\Dropbox\info.json)
{
    $DropboxPersonal = ((Get-Content $ENV:AppData\Dropbox\info.json) -join '`n' | ConvertFrom-json).personal.path
    $DropboxBusiness = ((Get-Content $ENV:AppData\Dropbox\info.json) -join '`n' | ConvertFrom-json).business.path
}
elseif (Test-Path $ENV:LocalAppData\Dropbox\info.json)
{
    $DropboxPersonal = ((Get-Content $ENV:LocalAppData\Dropbox\info.json) -join '`n' | ConvertFrom-json).personal.path
    $DropboxBusiness = ((Get-Content $ENV:LocalAppData\Dropbox\info.json) -join '`n' | ConvertFrom-json).business.path
}

# Backup Chocolatey package names on local computer to packages.config file in Personal Dropbox directory if it exists
if ($UseDropbox -match "True" -and ($DropboxPersonal) -and (Test-Path $DropboxPersonal))
   {
    $SavePath = "$DropboxPersonal\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Business Dropbox directory if it exists
if ($UseDropbox -match "True" -and ($DropboxBusiness) -and (Test-Path $DropboxBusiness))
   {
    $SavePath = "$DropboxBusiness\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Google Drive/Backup and Sync directory if it exists
if ($UseGoogleDrive -match "True" -and (Test-Path "$ENV:USERPROFILE\Google Drive"))   
   {
    $SavePath = "$ENV:USERPROFILE\Google Drive\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Google Drive FS "My Drive" directory if it exists (Thanks ebbek!)
$GFSInstalled=(Test-Path -path HKCU:Software\Google\DriveFS\Share)
if ($GFSInstalled)
   {
    $GoogleFSmountpoint = (Get-ItemProperty -path Registry::HKEY_CURRENT_USER\Software\Google\DriveFS\Share).MountPoint
    if ($UseGoogleDrive -match "True" -and ($GoogleFSmountpoint) -and (Test-Path "${GoogleFSmountpoint}:\My Drive"))
       {
        $SavePath = "${GoogleFSmountpoint}:\My Drive\$SaveFolderName\$ENV:ComputerName"
        Write-PackagesConfig
       }
	}
   
# Backup Chocolatey package names on local computer to packages.config file on your HOMESHARE directory if it exists
if ($ENV:HOMESHARE) {$ExistHomeShare="True"} else {$ExistHomeShare="False"}
if ($UseHomeShare -match "True" -and $ExistHomeShare -match "True")   
   {
    $SavePath = "$ENV:HOMESHARE\$SaveFolderName\$ENV:ComputerName"   
    Write-PackagesConfig
   }      

# Backup Chocolatey package names on local computer to packages.config file in iCloudDrive directory if it exists
if ($iCloudDrive -match "True" -and (Test-Path $ENV:USERPROFILE\iCloudDrive))
   {
    $SavePath = "$ENV:USERPROFILE\iCloudDrive\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }    
   
# Backup Chocolatey package names on local computer to packages.config file in Nextcloud directory if it exists
if ($UseNextcloud -match "True" -and (Test-Path $ENV:USERPROFILE\Nextcloud))
   {
    $SavePath = "$ENV:USERPROFILE\Nextcloud\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   } 
   
# Backup Chocolatey package names on local computer to packages.config file in OneDrive directory if it exists
if ($ENV:OneDrive) {$OneDriveExists="True"} else {$OneDriveExists="False"}
if ($UseOneDrive -match "True" -and ($OneDriveExists -match "True"))
   {
    $SavePath = "$ENV:OneDrive\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }      

# Backup Chocolatey package names on local computer to packages.config file in ownCloud directory if it exists
if ($UseownCloud -match "True" -and (Test-Path "$ENV:USERPROFILE\ownCloud"))
   {
    $SavePath = "$ENV:USERPROFILE\ownCloud\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Netgear ReadyCLOUD directory if it exists
if ($UseReadyCLOUD -match "True" -and (Test-Path $ENV:USERPROFILE\ReadyCLOUD))
   {
    $SavePath = "$ENV:USERPROFILE\ReadyCLOUD\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in Public directory if running under system account (only place it will save running under system except $CustomPath
if ($ENV:computername -eq $ENV:username.trim('$'))
   {
    $SavePath = "$ENV:PUBLIC\$SaveFolderName"
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in Resilio Sync directory if it exists
if ($UseResilioSync -match "True" -and (Test-Path "$ENV:USERPROFILE\Resilio Sync"))
   {
    $SavePath = "$ENV:USERPROFILE\Resilio Sync\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }   

# Backup Chocolatey package names on local computer to packages.config file in Seafile directory if it exists
if ($UseSeafile -match "True" -and (Test-Path $ENV:USERPROFILE\Documents\Seafile))
   {
    $SavePath = "$ENV:USERPROFILE\Seafile\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in TonidoSync directory if it exists
if ($UseTonidoSync -match "True" -and (Test-Path $ENV:USERPROFILE\Documents\TonidoSync))
   {
    $SavePath = "$ENV:USERPROFILE\Documents\TonidoSync\$SaveFolderName\$ENV:ComputerName"
    Write-PackagesConfig
   }

If ($ICinstalled){
     Write-Host "To re-install your Chocolatey packages: run INSTCHOCO -Y`n" -Foreground Magenta
   } else {
     Write-Host "To re-install your Chocolatey packages: run CINST PACKAGES.CONFIG -Y" -Foreground Magenta
     Write-Host "Consider getting InstChoco - The ULTIMATE Chocolatey and Chocolatey packages (re)installer!`nhttps://chocolatey.org/packages/InstChoco`n" -Foreground Cyan
   }
Write-Host "Found choco-package-list-backup.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
Start-Sleep -s 10 # Gives time to view before closing when run from Windows Start Menu shortcut
tools\choco-package-list-backup.xml
<?xml version="1.0"?>
<Settings>
  <Preferences>
    <PackagesListFile>packages.config</PackagesListFile>
    <SaveFolderName>ChocolateyPackageListBackup</SaveFolderName>
    <SaveVersions>false</SaveVersions>
    <AppendDate>false</AppendDate>
    <CustomPath>c:\install</CustomPath>
    <UseCustomPath>false</UseCustomPath>
    <UseDocuments>true</UseDocuments>
    <UseHomeShare>true</UseHomeShare>
    <UseBox>true</UseBox>
    <UseDropbox>true</UseDropbox>
    <UseGoogleDrive>true</UseGoogleDrive>
    <UseiCloudDrive>true</UseiCloudDrive>	
    <UseNextcloud>true</UseNextcloud>
    <UseOneDrive>true</UseOneDrive>
    <UseownCloud>true</UseownCloud>	
    <UseReadyCLOUD>true</UseReadyCLOUD>
    <UseResilioSync>true</UseResilioSync>
    <UseSeafile>true</UseSeafile>
    <UseTonidoSync>true</UseTonidoSync>
    <SaveAllProgramsList>true</SaveAllProgramsList>
    <AllProgramsListFile>AllProgramsList.txt</AllProgramsListFile>	
  </Preferences>
</Settings>

<!--
choco-package-list-backup.xml preferences notes:

AppendDate     - Change to true if you want to keep snapshot in time copies
SaveFolderName - Change the folder name if you don't like my default
SaveVersions   - Specify if you want to save specific package version info or not
CustomPath     - Edit to save to a special location of your choice
UseCustomPath  - Change to true if you are using CustomPath
UseXxxxxxxxx   - Should be obvious
SaveAllProgramsList - Save a list of all installed Windows programs (by Chocolatey or not) true/false
AllProgramsListFile - Filename to save the list of All installed Windows
-->
tools\choco-package-list-backup.xml - Shortcut.lnk
 
tools\ChocolateyInstall.ps1
$packageName      = 'choco-package-list-backup' 
$toolsDir         = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$Date             = Get-Date -UFormat %Y-%m-%d
$script           = 'choco-package-list-backup.ps1'
$xml              = 'choco-package-list-backup.xml'
$shortcutName     = 'Chocolatey Package List Backup.lnk'
$oldshortcutName  = 'Choco Package List Backup.lnk'
$altshortcutName  = 'Package List Backup.lnk'
$GotTask          = (&schtasks /query /tn choco-package-list-backup) 2> $null

Function Update-Config{
[xml]$UpdatedConfig = Get-Content "$ENV:ChocolateyInstall\bin\$xml"

$UseiCloudDrive = $UpdatedConfig.Settings.Preferences.UseiCloudDrive
if ($UseiCloudDrive -eq $null)
   {
    Write-Host Adding iCloudDrive support to $xml. -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "UseiCloudDrive", $null)
    $NewStuff.InnerText=("true") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | out-null
	$UpdatedFile = "True"
   }
$UseownCloud = $UpdatedConfig.Settings.Preferences.UseownCloud
if ($UseownCloud -eq $null)
   {
    Write-Host Adding ownCloud support to $xml. -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "UseownCloud", $null)
    $NewStuff.InnerText=("true") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | out-null
	$UpdatedFile = "True"
   }
$SaveAllProgramsList = $UpdatedConfig.Settings.Preferences.SaveAllProgramsList
if ($SaveAllProgramsList -eq $null)
   {
    Write-Host Adding SaveAllProgramsList support to $xml. -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "SaveAllProgramsList", $null)
    $NewStuff.InnerText=("true") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | out-null
	$UpdatedFile = "True"
   }
$AllProgramsListFile = $UpdatedConfig.Settings.Preferences.AllProgramsListFile
if ($AllProgramsListFile -eq $null)
   {
    Write-Host Adding AllProgramsListFile support to $xml. -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "AllProgramsListFile", $null)
    $NewStuff.InnerText=("AllProgramsList.txt") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | out-null
	$UpdatedFile = "True"
   }   
   
if ($UpdatedFile -eq "True")
   {   
    $UpdatedConfig.Save("$ENV:ChocolateyInstall\bin\$xml")
	Write-Host "Updated $xml" -Foreground Magenta
   }
}

Move-Item "$toolsDir\$script" $ENV:ChocolateyInstall\bin -Force -ErrorAction SilentlyContinue	

if ($GotTask -ne $null){
     Write-Host
     Write-Host Existing choco-package-list-backup scheduled task found: -Foreground Magenta 
     SchTasks /query /tn "choco-package-list-backup"
     Write-Host Keeping existing scheduled task and upgrading script files. -Foreground Magenta
  } else {
     SchTasks /Create /SC WEEKLY /D MON /RU SYSTEM /RL HIGHEST /TN "choco-package-list-backup" /TR "cmd /c powershell -NoProfile -ExecutionPolicy Bypass -Command %ChocolateyInstall%\bin\choco-package-list-backup.ps1" /ST 06:00 /F
     SchTasks /query /tn "choco-package-list-backup"
	 Write-Host "Now configured to run choco-package-list-backup at 6 AM every MONDAY." -Foreground Green
	}
   
if (Test-Path $ENV:ChocolateyInstall\bin\$xml){
      Remove-Item $toolsDir\$xml -Force -ErrorAction SilentlyContinue
	  Update-Config
    } else {
	  Move-Item "$toolsDir\$xml" $ENV:ChocolateyInstall\bin -Force -ErrorAction SilentlyContinue
      $WhoAmI=whoami
      $Acl = Get-Acl "$ENV:ChocolateyInstall\bin\$xml"
      $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($WhoAmI,"FullControl","Allow")
      $Acl.SetAccessRule($Ar)
      Set-Acl "$ENV:ChocolateyInstall\bin\$xml" $Acl
	}
	
If (Test-Path "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs\Chocolatey"){
      Remove-Item "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs\$oldshortcutName" -Force -ErrorAction SilentlyContinue
      Install-ChocolateyShortcut -shortcutFilePath "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs\Chocolatey\$altshortcutName" -targetPath "$ENV:SystemRoot\system32\WindowsPowerShell\v1.0\powershell.exe" -Arguments "-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command $script" -IconLocation $ENV:ChocolateyInstall\choco.exe -WorkingDirectory $ENV:ChocolateyInstall\bin\
    } else {
      Install-ChocolateyShortcut -shortcutFilePath "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs\$shortcutName" -targetPath "$ENV:SystemRoot\system32\WindowsPowerShell\v1.0\powershell.exe" -Arguments "-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command $script" -IconLocation $ENV:ChocolateyInstall\choco.exe -WorkingDirectory $ENV:ChocolateyInstall\bin\
	}
Write-Host "Running choco-package-list-backup.ps1 to create backup(s)..." -Foreground Magenta
&powershell -NoProfile -ExecutionPolicy Bypass -Command "$ENV:ChocolateyInstall\bin\choco-package-list-backup.ps1"
Write-Host "ADDITIONAL INFORMATION:" -Foreground Magenta
Write-Host "  * Edit $ENV:ChocolateyInstall\bin\$xml to customize your backup(s)." -Foreground Magenta
Write-Host "  * To manually backup your Chocolatey package list:" -Foreground Magenta
Write-Host "       Command Prompt - POWERSHELL CHOCO-PACKAGE-LIST-BACKUP.PS1" -Foreground Magenta
Write-Host "       PowerShell     - CHOCO-PACKAGE-LIST-BACKUP.PS1" -Foreground Magenta
If (Test-Path "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs\Chocolatey"){
     Write-Host "       Windows        - Click Package List Backup in the Start menu under Chocolatey" -Foreground Magenta
   } else {
     Write-Host "       Windows        - Click Chocolatey Package List Backup in the Start menu" -Foreground Magenta
   }
tools\ChocolateyUninstall.ps1
$packageName     = 'choco-package-list-backup' 
$script          = 'choco-package-list-backup.ps1'
$xml             = 'choco-package-list-backup.xml'
$oldshortcutName = 'Choco Package List Backup.lnk'
$shortcutName    = 'Chocolatey Package List Backup.lnk'
$altshortcutName = 'Package List Backup.lnk'

SchTasks /Delete /TN choco-package-list-backup /F

Remove-Item "$env:ChocolateyInstall\bin\$script" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ChocolateyInstall\bin\$script*.bak" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ChocolateyInstall\bin\$xml" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\$oldshortcutName" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\$shortcutName" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Chocolatey\$altshortcutName" -Force -ErrorAction SilentlyContinue

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) Choco Package List Backup to Local and Cloud (Script + Task) 2023.6.2 2672 Tuesday, June 6, 2023 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2023.6.2-pre 100 Saturday, June 3, 2023 Exempted
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2023.05.13-pre 99 Saturday, May 13, 2023 Exempted
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2022.02.06 11293 Sunday, February 6, 2022 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.09.25 6026 Sunday, September 26, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.09.22 1592 Wednesday, September 22, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.05.10 5491 Tuesday, May 11, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.04.08 3275 Friday, April 9, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.22 3466 Tuesday, March 23, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.15 2395 Monday, March 15, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.14 269 Sunday, March 14, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2020.04.06 5972 Monday, April 6, 2020 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.08.27 5897 Tuesday, August 27, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.07.02 3981 Tuesday, July 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.06.27 236 Tuesday, July 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.31.01 2296 Saturday, February 9, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.31 940 Friday, February 1, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.29 695 Tuesday, January 29, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.24 782 Friday, January 25, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.04 954 Friday, January 4, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.02 627 Wednesday, January 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2018.08.23 1581 Friday, August 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2018.06.21 1016 Friday, June 22, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.19 853 Saturday, May 19, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.17 532 Thursday, May 17, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.09 599 Wednesday, May 9, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.06 523 Sunday, May 6, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.25 591 Thursday, April 26, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.24.01 530 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.24 399 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.23 450 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.02.24 818 Saturday, February 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.02.12 517 Tuesday, February 13, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.01.29 420 Tuesday, January 30, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2017.12.17 618 Monday, December 18, 2017 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2017.08.19 929 Sunday, August 20, 2017 Approved

INSTRUCTIONS:

  • Edit C:\ProgramData\chocolatey\bin\choco-package-list-backup.xml to customize your backup(s). It's easy, there are comments.
  • From PowerShell, type CHOCO-PACKAGE-LIST-BACKUP.PS1 to backup your Chocolatey packages list.
  • From Command Prompt, type POWERSHELL CHOCO-PACKAGE-LIST-BACKUP.PS1 to backup your Chocolatey packages list.
  • From Windows, click Chocolatey Package List Backup in the Windows Start Menu or Package List Backup inside the Chocolatey folder if Chocolatey Shortcuts is installed.

CHANGELOG:

  • 2019.01.24 - now saves your pinned package information to pins.bat, added saving to c:\Users\Public when run from system account (e.g. scheduled task), fixed error attempting to create files under system account Documents folder which doesn't exist, packages.config now properly UTF-8 encoded, speed optimizations, minor cosmetic changes
  • 2019.01.04 - 2019.01.02 didn't get packaged with the install and uninstall scripts! - fixed (GitHub bit me)
  • 2019.01.02 - Will now write to Documents/MyDocuments if the folder has been moved, thanks Aaron Throckmorton for the enhancement!
  • 2018.08.23 - Added ownCloud support and save all programs list feature
  • 2018.06.21 - Added scheduled task to run every Monday at 6 AM. AppendDate option now saves packages.config AND a packages_date.config. This makes the AppendDate option more useful for a nearline packages.config and archival snapshots as well as fixing compatibility with InstChoco.
  • 2018.05.19 - OneDrive and shortcut creation bugs fixed, minor cosmetic changes
  • 2018.05.17 - added iCloudDrive support
  • 2018.05.09 - added reading preferences from choco-package-list-backup.xml - no more editing the script after upgrades! Backups not created any more.
  • 2018.05.06 - added Dropbox Business and Google Drive File Stream support (Thanks ebbek!)
  • 2018.04.25 - removed run as admin requirement
  • 2018.04.25 - now makes a backup of previous choco-packages-list-backup.ps1 (Since removed.)
  • 2018.04.25 - fixed minor text output error
  • 2018.04.25 - added compatibility with choco-shortcuts-winconfig
  • 2018.04.24.01 - added ability to append the date to PACKAGES.CONFIG
  • 2018.04.24 - added choco-persistent-packages support.
  • 2018.04.23 - now backups up packages automatically on install
  • 2018.02.24 - added Box and Seafile support as well as an icon to run from the Windows Start menu
  • 2018.02.12 - added Nextcloud support (thanks thomasaiman) and fixed TonidoSync (Thanks thomasaiman!)
  • 2018.01.29 - edited re-installation message, updated donation info :)
  • 2017.12.17 - added editable custom save location (requested)

ROADMAP:

  • Investigate running the schedule task from the installing user account.
  • Add other cloud services support by request
  • I'm open to suggestions - open a GitHub issue please.

This package has no dependencies.

Discussion for the (unofficial) Choco Package List Backup to Local and Cloud (Script + Task) Package

Ground Rules:

  • This discussion is only about (unofficial) Choco Package List Backup to Local and Cloud (Script + Task) and the (unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 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) Choco Package List Backup to Local and Cloud (Script + Task), 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