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:

127,018

Downloads of v 2023.6.28:

59,685

Last Update:

28 Jun 2023

Package Maintainer(s):

Software Author(s):

  • Bill Curran

Tags:

bcurran3 choco unofficial package packages.config backup script cloud

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

  • 1
  • 2
  • 3

2023.6.28 | Updated: 28 Jun 2023

Downloads:

127,018

Downloads of v 2023.6.28:

59,685

Maintainer(s):

Software Author(s):

  • Bill Curran

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

  • 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'" [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'" 
$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: '2023.6.28'
    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  '2023.6.28'
end

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


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

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


package { 'choco-package-list-backup':
  ensure   => '2023.6.28',
  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 TheCakeIsNaOH on 01 Jul 2023.

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 (free, paid consumer, and corporate)
    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\Documents 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\Documents. 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: (continued in Release Notes)

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.config
<?xml version="1.0"?>
<Settings>
  <Preferences>
    <PackagesListFile>packages.config</PackagesListFile>
    <SaveFolderName>ChocolateyPackageListBackup</SaveFolderName>
    <SaveTitleSummary>false</SaveTitleSummary>
    <SaveVersions>false</SaveVersions>
    <AppendDate>false</AppendDate>
    <CustomPath>c:\install</CustomPath>
    <UseCustomPath>false</UseCustomPath>
    <CustomPath2>c:\backup</CustomPath2>
    <UseCustomPath2>false</UseCustomPath2>
    <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>
    <DefaultUserProfile></DefaultUserProfile>
    <UseDefaultUserProfile>false</UseDefaultUserProfile>
    <SaveArguments>false</SaveArguments>
    <PreProcessScript></PreProcessScript>
    <PostProcessScript></PostProcessScript>
  </Preferences>
</Settings>

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

PackagesListFile      - Filename to save the list of Chocolatey packages.
SaveFolderName        - Change the folder name if you don't like my default, do NOT use quotes.
SaveTitleSummary      - Change to true if you want to save package title and summary info. 
SaveVersions          - Change to true if you want to save pacakge version info.
AppendDate            - Change to true if you want to keep snapshot in time copies.
CustomPath            - Edit to save to a special location of your choice, do NOT use quotes.
CustomPath2           - Edit to save to a 2nd special location of your choice, do NOT use quotes.
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.
DefaultUserProfile    - Default user profile to use when running as SYSTEM (task); e.g. William, Robert, Benjamin (HINT: Look at C:\Users)
UseDefaultUserProfile - Change to true if you are want to use DefaultUserProfile
SaveArguments         - Save install arguments
PreProcessScript      - Script to run before CPLB; e.g. c:\scripts\beforeCPLB.bat
PostProcessScript     - Script to run after CPLB; e.g. c:\scripts\afterCPLB.bat

NOTE: When using a schedule task, be sure to enter your DefaultUserProfile and set UseDefaultUserProfile to true.
-->
tools\choco-package-list-backup.ico
 
tools\choco-package-list-backup.ps1
$ErrorActionPreference = 'Stop'
# Choco-Package-List-Backup.ps1 Copyleft 2017-2023 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.

Write-Host "Choco-Package-List-Backup.ps1 v2023.06.28 - backup Chocolatey packages list locally and to the cloud" -Foreground White
Write-Host "Copyleft 2017-2023 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White
Write-Host "Choco Package List Backup Summary:`n" -Foreground Magenta

# Set Notepad++ as preferred editor/viewer
if (Test-Path $env:ChocolateyInstall\bin\notepad++.exe){
     $Editor="notepad++.exe"
    } else {
      $Editor="notepad.exe"
    }

# Easily edit the config file
if ($args -eq "-EditConfig") {
    Write-Host "  ** Editing contents of choco-package-list-backup.config." -Foreground Magenta
	&$Editor "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.config"
	return
}

# Easily view the log file
if ($args -eq "-ViewLog"){
	Write-Host "  ** Showing contents of choco-package-list-backup.log." -Foreground Magenta
	&$Editor "$ENV:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
	return
}

##### VARIABLES BEGIN

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

$Date           = Get-Date -UFormat %Y-%m-%d
$ErrorArray     = @("this is try","error converted","access to path") #errors caused by Chocolatey not being multi-instance aware (Hopefully in v1.0!)
$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"
$scriptDir      = "$env:ChocolateyToolsLocation\BCURRAN3"
$ScriptConfig   = 'choco-package-list-backup.config'

# Set default preferences in case of corrupt or missing choco-package-list-backup.config
$PackagesListFile    = 'packages.config'
$SaveFolderName      = 'ChocolateyPackageListBackup'
$SaveArguments       = $False
$SaveTitleSummary    = $False
$SaveVersions        = $False
$AppendDate          = $False
$CustomPath          = 'c:\install'
$CustomPath2         = 'c:\backup'
$SaveAllProgramsList = $True
$AllProgramsListFile = 'AllProgramsList.txt'
$DefaultUserProfile  = ''
$PreProcessScript    = ''
$PostProcessScript   = ''

$UseCustomPath  = $False
$UseCustomPath2 = $False
$UseDocuments   = $True
$UseHomeShare   = $True
$UseBox         = $True
$UseDropbox     = $True
$UseGoogleDrive = $True
$UseiCloudDrive = $True
$UseNextcloud   = $True
$UseOneDrive    = $True
$UseownCloud    = $True
$UseReadyCLOUD  = $True
$UseResilioSync = $True
$UseSeafile     = $True
$UseTonidoSync  = $True
$UseDefaultUserProfile = $False

# Import preferences - see comments in choco-package-list-backup.config for settings
if (Test-Path "$scriptDir\choco-package-list-backup.config") {
   [xml]$ConfigFile     = Get-Content "$scriptDir\choco-package-list-backup.config"
   $PackagesListFile    = $ConfigFile.Settings.Preferences.PackagesListFile
   $SaveFolderName      = $ConfigFile.Settings.Preferences.SaveFolderName
   if ($ConfigFile.Settings.Preferences.SaveArguments -eq "true") {$SaveArguments=$True} else {$SaveArguments=$False}
   if ($ConfigFile.Settings.Preferences.SaveTitleSummary -eq "true") {$SaveTitleSummary=$True} else {$SaveTitleSummary=$False}
   if ($ConfigFile.Settings.Preferences.SaveVersions -eq "true") {$SaveVersions=$True} else {$SaveVersions=$False}
   if ($ConfigFile.Settings.Preferences.AppendDate -eq "true") {$AppendDate=$True} else {$AppendDate=$False}
   $CustomPath          = $ConfigFile.Settings.Preferences.CustomPath
   $CustomPath2         = $ConfigFile.Settings.Preferences.CustomPath2
   if ($ConfigFile.Settings.Preferences.SaveAllProgramsList -eq "true") {$SaveAllProgramsList=$True} else {$SaveAllProgramsList=$False}
   $AllProgramsListFile = $ConfigFile.Settings.Preferences.AllProgramsListFile
   $DefaultUserProfile  = $ConfigFile.Settings.Preferences.DefaultUserProfile
   $PreProcessScript    = $ConfigFile.Settings.Preferences.PreProcessScript
   $PostProcessScript   = $ConfigFile.Settings.Preferences.PostProcessScript

   if ($ConfigFile.Settings.Preferences.UseCustomPath -eq "true") {$UseCustomPath=$True} else {$UseCustomPath=$False}
   if ($ConfigFile.Settings.Preferences.UseCustomPath2 -eq "true") {$UseCustomPath2=$True} else {$UseCustomPath2=$False}
   if ($ConfigFile.Settings.Preferences.UseDocuments -eq "true") {$UseDocuments=$True} else {$UseDocuments=$False}
   if ($ConfigFile.Settings.Preferences.UseHomeShare -eq "true") {$UseHomeShare=$True} else {$UseHomeShare=$False}
   if ($ConfigFile.Settings.Preferences.UseBox -eq "true") {$UseBox=$True} else {$UseBox=$False}
   if ($ConfigFile.Settings.Preferences.UseDropbox -eq "true") {$UseDropbox=$True} else {$UseDropbox=$False}
   if ($ConfigFile.Settings.Preferences.UseGoogleDrive -eq "true") {$UseGoogleDrive=$True} else {$UseGoogleDrive=$False}
   if ($ConfigFile.Settings.Preferences.UseiCloudDrive -eq "true") {$UseiCloudDrive=$True} else {$UseiCloudDrive=$False}
   if ($ConfigFile.Settings.Preferences.UseNextcloud -eq "true") {$UseNextcloud=$True} else {$UseNextcloud=$False}
   if ($ConfigFile.Settings.Preferences.UseOneDrive -eq "true") {$UseOneDrive=$True} else {$UseOneDrive=$False}
   if ($ConfigFile.Settings.Preferences.UseownCloud -eq "true") {$UseownCloud=$True} else {$UseownCloud=$False}
   if ($ConfigFile.Settings.Preferences.UseReadyCLOUD -eq "true") {$UseReadyCLOUD=$True} else {$UseReadyCLOUD=$False}
   if ($ConfigFile.Settings.Preferences.UseResilioSync -eq "true") {$UseResilioSync=$True} else {$UseResilioSync=$False}
   if ($ConfigFile.Settings.Preferences.UseSeafile -eq "true") {$UseSeafile=$True} else {$UseSeafile=$False}
   if ($ConfigFile.Settings.Preferences.UseTonidoSync -eq "true") {$UseTonidoSync=$True} else {$UseTonidoSync=$False}
   if ($ConfigFile.Settings.Preferences.UseDefaultUserProfile -eq "true") {$UseDefaultUserProfile=$True} else {$UseDefaultUserProfile=$False}
   } else { 
     Write-Warning "   ** choco-package-list-backup.config not found, using defaults." 
}

if ($AppendDate){
    if ($PackagesListFile -eq "packages.config"){
		 $PackagesListArchival = "packages_$Date.config"
		} else {
		  $PackagesListArchival = $PackagesListFile+"_$Date.config"
		}
}
 
if ($SaveAllProgramsList) {
    $SaveAllProgramsBody = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher
}    
 
# When running as SYSTEM (scheduled task) use the $DefaultUserProfile as the default user profile if defined
if ($DefaultUserProfile -and $UseDefaultUserProfile) {
	$env:USERPROFILE = "$env:SystemDrive\Users\$DefaultUserProfile"
	$env:APPDATA = "$env:SystemDrive\Users\$DefaultUserProfile\AppData\Roaming"
}

##### VARIABLES END
##### FUNCTIONS BEGIN

# add to log file
function Add2Log {
  Param ( [string]$comment )

  Write-Output "$(Get-Date) [INFO ] $comment" >> "$ENV:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
}

# Check the path to save packages.config and create if it doesn't exist
Function Check-SaveLocation{
  if (!(Test-Path $SavePath)) {New-Item $SavePath -Type Directory -Force | Out-Null}   
}

# Copy choco-package-list-backup.config to the same location as packages.config
Function Copy-Config{
  if (Test-Path "$scriptDir\choco-package-list-backup.config") {
      if (Test-Path "$SavePath\choco-package-list-backup.config.bak") {Remove-Item "$SavePath\choco-package-list-backup.config.bak"}
      if (Test-Path "$SavePath\choco-package-list-backup.config") {Rename-Item "$SavePath\choco-package-list-backup.config" "$SavePath\choco-package-list-backup.config.bak"}
      Copy-Item "$scriptDir\$ScriptConfig" $SavePath -Force | Out-Null
      Write-Host "  ** $SavePath\$ScriptConfig SAVED!" -Foreground Green
	  Add2Log "SAVED: $SavePath\$ScriptConfig"
     }
}

# Copy persistentpackages.config if it exists to the same location as packages.config
Function Copy-PPConfig{
   if (Test-Path "$SavePath\persistentpackages.config.bak") {Remove-Item "$SavePath\persistentpackages.config.bak"}
   if (Test-Path "$SavePath\persistentpackages.config") {Rename-Item "$SavePath\persistentpackages.config" "$SavePath\persistentpackages.config.bak"}
   Copy-Item $env:ChocolateyInstall\config\persistentpackages.config $SavePath -Force | Out-Null
   Write-Host "  ** $SavePath\persistentpackages.config SAVED!" -Foreground Green 
   Add2Log "SAVED: $SavePath\persistentpackages.config"
}
	
# 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
    if (!(Test-Path $SavePath\InstChoco.exe))
       {
        Copy-Item $InstChoco $SavePath -Force | Out-Null
        Write-Host "  ** $SavePath\InstChoco.exe COPIED!" -Foreground Green
		Add2Log "COPIED: $SavePath\InstChoco.exe"
	   } 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
			 Add2Log "COPIED: $SavePath\InstChoco.exe"
	        }
	   }
}

#Un-encrypt .arguments file
Add-Type -AssemblyName System.Security
$entropyBytes = [System.Text.UTF8Encoding]::UTF8.GetBytes("Chocolatey")
Function Unprotect-Arguments {
    param([string]$data)
    $encryptedByteArray = [System.Convert]::FromBase64String($data)
    $decryptedByteArray = [System.Security.Cryptography.ProtectedData]::Unprotect(
        $encryptedByteArray,
        $entropyBytes,
        [System.Security.Cryptography.DataProtectionScope]::LocalMachine
    )
    return [System.Text.UTF8Encoding]::UTF8.GetString($decryptedByteArray)
}

function Read-Arguments {
    param([string]$packageName)
    $directory = Get-ChildItem $env:ChocolateyInstall\.chocolatey -Directory -Filter "$packageName*" | `
        Where-Object { $_.Name -match ("$packageName" + "\.[\d\.]+") } | Select-Object -Last 1
    if (!($directory)) { return }
    $argsFile = Join-Path $directory.fullname ".arguments"
    if (Test-Path $argsFile) {
        $argsData = Get-Content $argsFile
        #Implicitly return result from Unprotect-Arguments
        Unprotect-Arguments -data $argsData
    }
}

# Import package.nuspec file to get extended package info
function Get-NuspecInfo($PackageName,$NuspecTagRequest){
   $nuspecXML = "$env:ChocolateyInstall\lib\$PackageName\$PackageName.nuspec"
   if (!(Test-Path $nuspecXML)) { return "Unknown" }
   [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 # Not fully implemented yet
#   $NuspecDescription      = $nuspecFile.package.metadata.description
#   $NuspecDocsURL          = $nuspecFile.package.metadata.docsurl
#   $NuspecFiles            = $nuspecFile.package.files.file # Not fully implemented yet
#   $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

#   if ($NuspecTagRequest -eq "authors") {return $NuspecAuthors}
#   if ($NuspecTagRequest -eq "bugtrackerurl") {return $NuspecBugTrackerURL}
#   if ($NuspecTagRequest -eq "conflicts") {return $NuspecConflicts}
#   if ($NuspecTagRequest -eq "copyright") {return $NuspecCopyright}
#   if ($NuspecTagRequest -eq "dependencies") {return $NuspecDependencies} # Not fully implemented yet
#   if ($NuspecTagRequest -eq "description") {return $NuspecDescription}
#   if ($NuspecTagRequest -eq "docsurl") {return $NuspecDocsURL}
#   if ($NuspecTagRequest -eq "files") {return $NuspecFiles} # Not fully implemented yet
#   if ($NuspecTagRequest -eq "iconurl") {return $NuspecIconURL}
#   if ($NuspecTagRequest -eq "id") {return $NuspecID}
#   if ($NuspecTagRequest -eq "licenseurl") {return $NuspecLicenseURL}
#   if ($NuspecTagRequest -eq "mailinglisturl") {return $NuspecMailingListURL}
#   if ($NuspecTagRequest -eq "owners") {return $NuspecOwners}
#   if ($NuspecTagRequest -eq "packagesourceurl") {return $NuspecPackageSourceURL}
#   if ($NuspecTagRequest -eq "projectsourceurl") {return $NuspecProjectSourceURL}
#   if ($NuspecTagRequest -eq "projecturl") {return $NuspecProjectURL}
#   if ($NuspecTagRequest -eq "provides") {return $NuspecProvides}
#   if ($NuspecTagRequest -eq "releasenotes") {return $NuspecReleaseNotes}
#   if ($NuspecTagRequest -eq "replaces") {return $NuspecReplaces}
#   if ($NuspecTagRequest -eq "requirelicenseacceptance") {return $NuspecRequireLicenseAcceptance}
   if ($NuspecTagRequest -eq "summary") {return $NuspecSummary}
#   if ($NuspecTagRequest -eq "tags") {return $NuspecTags}
   if ($NuspecTagRequest -eq "title") {return $NuspecTitle}
#   if ($NuspecTagRequest -eq "version") {return $NuspecVersion}
}

# Write out the saved list of ALL installed programs to AllProgramsList.txt
Function Write-AllProgramsList{
    $header="All installed programs list generated by choco-package-list-backup on $Date.`n"
	if (Test-Path "$SavePath\$AllProgramsListFile.bak") {Remove-Item "$SavePath\$AllProgramsListFile.bak"}
	if (Test-Path "$SavePath\$AllProgramsListFile") {Rename-Item "$SavePath\$AllProgramsListFile" "$SavePath\$AllProgramsListFile.bak"}
	Write-Output $header $SaveAllProgramsBody | Out-File "$SavePath\$AllProgramsListFile" -Encoding ASCII
	Write-Host "  ** $SavePath\$AllProgramsListFile SAVED!" -Foreground Green
	Add2Log "SAVED: $SavePath\$AllProgramsListFile"
# 2nd copy in format AllProgramsList_date.txt if AppendDate is set to true
	if ($AppendDate -eq "True"){
	    $AllProgramsListFileArchival = $AllProgramsListFile.Replace(".txt","")+"_$Date.txt"
	    Write-Output $header $SaveAllProgramsBody | Out-File "$SavePath\$AllProgramsListFileArchival" -Encoding ASCII
	    Write-Host "  ** $SavePath\$AllProgramsListFileArchival SAVED!" -Foreground Green
		Add2Log "SAVED: $SavePath\$AllProgramsListFileArchival"
	   }
}  

# Write out pins.bat to easily re-pin previously pinned packages
Function Write-PinnedList{
	$header="@echo off`nrem pinned packages found by choco-package-list-backup.ps1 on $Date :`necho   ** Re-pinning previously pinned Chocolatey packages."
	if ($SaveVersions){
	    $body=$PinnedPackages | % {"choco pin add -n=$($_.SubString(0, $_.IndexOf("|"))) --version $($_.SubString($_.IndexOf("|") + 1))"}
		} else {
		  $body=$PinnedPackages | % {"choco pin add -n=$($_.SubString(0, $_.IndexOf("|")))"}
		}
	if ($body -Match $ErrorArray[0-3]) {
	    Write-Warning "  ** Another instance of choco.exe was running and corrupted the output. Aborting..."
		throw
		}
	if (Test-Path "$SavePath\$PinnedPackagesFile.bak") {Remove-Item "$SavePath\$PinnedPackagesFile.bak"}
	if (Test-Path "$SavePath\$PinnedPackagesFile") {Rename-Item "$SavePath\$PinnedPackagesFile" "$SavePath\$PinnedPackagesFile.bak"}
	Write-Output $header $body | Out-File "$SavePath\$PinnedPackagesFile" -Encoding ASCII
	Write-Host "  ** $SavePath\$PinnedPackagesFile SAVED!" -Foreground Green
	Add2Log "SAVED: $SavePath\$PinnedPackagesFile"
# 2nd copy in format pins_date.bat if AppendDate is set to true
	if ($AppendDate -eq "True"){
	    $PinnedPackagesFile = $PinnedPackagesFile.Replace(".bat","")+"_$Date.bat"
	    Write-Output $header $body | Out-File "$SavePath\$PinnedPackagesFile" -Encoding ASCII
	    Write-Host "  ** $SavePath\$PinnedPackagesFile SAVED!" -Foreground Green
		Add2Log "SAVED: $SavePath\$PinnedPackagesFile"
	   }
}
  
# Write out the saved list of packages to packages.config
Function Write-PackagesConfig{
    Check-SaveLocation
	$header="<?xml version=`"1.0`" encoding=`"utf-8`"?>`n<packages>"
	$footer="</packages>"
	if ($body -Match $ErrorArray[0-3]) {
	    Write-Warning "  ** Another instance of choco.exe was running and corrupted the output. Aborting..."
		throw
		}
    if (Test-Path "$SavePath\$PackagesListFile.bak") {Remove-Item "$SavePath\$PackagesListFile.bak"}
	if (Test-Path "$SavePath\$PackagesListFile") {Rename-Item "$SavePath\$PackagesListFile" "$SavePath\$PackagesListFile.bak"}
	Write-Output $header $PackagesConfigBody $footer | Out-File "$SavePath\$PackagesListFile" -Encoding ASCII #ASCII is a subset of UTF8 (w/o BOM)
	Write-Host "  ** $SavePath\$PackagesListFile SAVED!" -Foreground Green
	Add2Log "SAVED: $SavePath\$PackagesListFile"
	
# 2nd copy in format packages.config_date.config if AppendDate is set to true	
	if ($AppendDate -eq "True"){
	    Write-Output $header $PackagesConfigBody $footer | Out-File "$SavePath\$PackagesListArchival" -Encoding ASCII #ASCII is a subset of UTF8 (w/o BOM)
		Write-Host "  ** $SavePath\$PackagesListArchival SAVED!" -Foreground Green
		Add2Log "SAVED: $SavePath\$PackagesListArchival"
		}
    Copy-Config
	if ($PPCinstalled) {Copy-PPConfig}
	if ($SaveAllProgramsList){Write-AllProgramsList}
	if (!$PinnedPackages){Remove-Item "$SavePath\$PinnedPackagesFile" -EA SilentlyContinue | Out-Null }
	if ($PinnedPackages){Write-PinnedList}
	if ($ICinstalled) {Copy-InstChoco}
	Write-Host
}

##### FUNCTIONS END
##### START PROCESSING

# Start logging
if (Test-Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"){
   $LogSize=(Get-ChildItem -Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log").length
   if ($LogSize -gt 40960) {
	   Remove-Item "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log" -ErrorAction SilentlyContinue
	   Write-Output "$(Get-Date) Choco-Package-List-Backup Deleted log file" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
	  }
   Write-Output "----------------------------------------------------------------------" >> "$ENV:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
   Write-Output "$(Get-Date) Choco-Package-List-Backup STARTED" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
}

# Run pre-processor if configured
if ($PreProcessScript) {
	Add2Log "CONFIG: PreProcessScript is set to `"$PreProcessScript`""
	Add2Log "RUNNING: $PreProcessScript."
	&$PreProcessScript
}

# Get list of installed packages
# Handle choco list v0-1/v2+ differently
if ([System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:ChocolateyInstall\choco.exe").ProductMajorPart -gt 1){
	 $localPackageInfo = & choco list -r -y
	} else {
		$localPackageInfo = & choco list -lo -r -y
}

# Process list of installed packages for package.config
if ($SaveTitleSummary) { Add2Log "CONFIG: SaveTitleSummary is set to $SaveTitleSummary" }
if ($SaveArguments) { Add2Log "CONFIG: SaveArguments is set to $SaveArguments" }
$PackagesConfigBody = $localPackageInfo | % {
    $packageName = $($_.SubString(0, $_.IndexOf("|")))
    $line = '   <package id="' + $packageName + '" '
    if ($SaveTitleSummary) {
        $line = $line + 'title="' + [System.Security.SecurityElement]::Escape($(get-nuspecinfo "$($_.SubString(0, $_.IndexOf("|")))" "title")) + '" '
        $line = $line + 'summary="' + [System.Security.SecurityElement]::Escape($(get-nuspecinfo "$($_.SubString(0, $_.IndexOf("|")))" "summary")) + '" '
    }
    if ($SaveArguments) {
        $line = $line + 'arguments="' + [System.Security.SecurityElement]::Escape($(Read-Arguments $packageName)) + '" '
    }
    $line = $line + '/>'
    $line
}

##### START SAVE BACKUPS

# Backup Chocolatey package names to packages.config file in custom defined path you set as CustomPath in the config file
if ($UseCustomPath) {Add2Log "CONFIG: UseCustomPath is set to $UseCustomPath"}
if ($UseCustomPath -and (Test-Path $CustomPath))
   {
    $SavePath   = "$CustomPath\$SaveFolderName"
	Write-Host "  ** Saving to CUSTOMPATH:" -Foreground Green
    Write-PackagesConfig
   }

# Backup Chocolatey package names to packages.config file in custom defined path you set as CustomPath in the config file
if ($UseCustomPath2) {Add2Log "CONFIG: UseCustomPath2 is set to $UseCustomPath2"}
if ($UseCustomPath2 -and (Test-Path $CustomPath2))
   {
    $SavePath   = "$CustomPath2\$SaveFolderName"
	Write-Host "  ** Saving to CUSTOMPATH2:" -Foreground Green
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in the Documents folder
if ($UseDocuments) {Add2Log "CONFIG: UseDocuments is set to $UseDocuments"}
if ($env:COMPUTERNAME -eq $env:USERNAME.trim('$')) { $DocumentsFolder = "$env:PUBLIC\Documents" } else { $DocumentsFolder = [Environment]::GetFolderPath("MyDocuments") }
if (($DefaultUserProfile) -and ($UseDefaultUserProfile)) { $DocumentsFolder = "$env:USERPROFILE\Documents" }
if ($DocumentsFolder -ne ""){
   if ($UseDocuments -and (Test-Path $DocumentsFolder))
       {
		Add2Log "CONFIG: DocumentsFolder is set to `"$DocumentsFolder`""
        $SavePath   = "$DocumentsFolder\$SaveFolderName"
		Write-Host "  ** Saving to DOCUMENTS:" -Foreground Green
        Write-PackagesConfig
       }
   } 
   
# Backup Chocolatey package names on local computer to packages.config file in Box (Sync) directory if it exists
if ($UseBox) {Add2Log "CONFIG: UseBox is set to $UseBox"}
if ($UseBox -and (Test-Path "$env:USERPROFILE\Box Sync"))
   {
    $SavePath = "$env:USERPROFILE\Box Sync\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to BOX SYNC:" -Foreground Green
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in Box (Drive) directory if it exists
if ($UseBox -and (Test-Path "$env:USERPROFILE\Box"))
   {
    $SavePath = "$env:USERPROFILE\Box\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to BOX:" -Foreground Green
    Write-PackagesConfig
   }

# Check for Dropbox personal and business paths (Thanks ebbek!)
if ($UseDropbox) {Add2Log "CONFIG: UseDropbox is set to $UseDropbox"}
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 -and ($DropboxPersonal) -and (Test-Path $DropboxPersonal))
   {
    $SavePath = "$DropboxPersonal\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to DROPBOX:" -Foreground Green
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Business Dropbox directory if it exists
if ($UseDropbox -and ($DropboxBusiness) -and (Test-Path $DropboxBusiness))
   {
    $SavePath = "$DropboxBusiness\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to DROPBOX (Business):" -Foreground Green
    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) {Add2Log "CONFIG: UseGoogleDrive is set to $UseGoogleDrive"}
if ($UseGoogleDrive -and (Test-Path "$env:USERPROFILE\Google Drive"))   
   {
    $SavePath = "$env:USERPROFILE\Google Drive\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to GOOGLE DRIVE:" -Foreground Green
    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 -and $GoogleFSmountpoint -and (Test-Path "${GoogleFSmountpoint}:\My Drive"))
       {
        $SavePath = "${GoogleFSmountpoint}:\My Drive\$SaveFolderName\$env:COMPUTERNAME"
		Write-Host "  ** Saving to GOOGLE DRIVE FS:" -Foreground Green
        Write-PackagesConfig
       }
	}
   
# Backup Chocolatey package names on local computer to packages.config file on your HOMESHARE directory if it exists
# NOTE: Won't work when running as SYSTEM
if ($UseHomeShare) {Add2Log "CONFIG: UseHomeShare is set to $UseHomeShare"}
if ($env:HOMESHARE) {$ExistHomeShare=$True} else {$ExistHomeShare=$False}
if ($UseHomeShare -and $ExistHomeShare)   
   {
    $SavePath = "$env:HOMESHARE\$SaveFolderName\$env:COMPUTERNAME"   
	Write-Host "  ** Saving to HOMESHARE:" -Foreground Green
    Write-PackagesConfig
   }      

# Backup Chocolatey package names on local computer to packages.config file in iCloudDrive directory if it exists
if ($UseiCloudDrive) {Add2Log "CONFIG: UseiCloudDrive is set to $UseiCloudDrive"}
if ($UseiCloudDrive -and (Test-Path $env:USERPROFILE\iCloudDrive))
   {
    $SavePath = "$env:USERPROFILE\iCloudDrive\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to ICLOUD:" -Foreground Green
    Write-PackagesConfig
   }    
   
# Backup Chocolatey package names on local computer to packages.config file in Nextcloud directory if it exists
if ($UseNextcloud) {Add2Log "CONFIG: UseNextcloud is set to $UseNextcloud"}
if ($UseNextcloud -and (Test-Path $env:USERPROFILE\Nextcloud))
   {
    $SavePath = "$env:USERPROFILE\Nextcloud\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to NEXTCLOUD:" -Foreground Green
    Write-PackagesConfig
   } 
   
# Backup Chocolatey package names on local computer to packages.config file in various OneDrive directories if they exists
if ($UseOneDrive) {Add2Log "CONFIG: UseOneDrive is set to $UseOneDrive"}
$OneDriveWritten=$False
if ($env:OneDrive) {$OneDriveExists=$True} else {$OneDriveExists=$False}
if ($UseOneDrive -and $OneDriveExists)
   {
    $SavePath = "$env:OneDrive\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to ONEDRIVE:" -Foreground Green
    Write-PackagesConfig
	$OneDriveWritten=$True
   }

if (Test-Path $env:USERPROFILE\OneDrive) {$OneDriveExists=$True} else {$OneDriveExists=$False}
if ($UseOneDrive -and $OneDriveExists)
   {
	if (!$OneDriveWritten)
	   {
        $SavePath = "$env:USERPROFILE\OneDrive\$SaveFolderName\$env:COMPUTERNAME"
		Write-Host "  ** Saving to ONEDRIVE:" -Foreground Green
        Write-PackagesConfig
	   }
   }
   
if ($env:OneDriveConsumer) {$OneDriveExists=$True} else {$OneDriveExists=$False}
if ($UseOneDrive -and $OneDriveExists)
   {
    $SavePath = "$env:OneDriveConsumer\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to ONEDRIVE:" -Foreground Green
    Write-PackagesConfig
   }
   
if ($env:OneDriveCommercial) {$OneDriveExists=$True} else {$OneDriveExists=$False}
if ($UseOneDrive -and $OneDriveExists)
   {
    $SavePath = "$env:OneDriveCommercial\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to ONEDRIVE (Business):" -Foreground Green
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in ownCloud directory if it exists
if ($UseownCloud) {Add2Log "CONFIG: UseownCloud is set to $UseownCloud"}
if ($UseownCloud -and (Test-Path "$env:USERPROFILE\ownCloud"))
   {
    $SavePath = "$env:USERPROFILE\ownCloud\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to OWNCLOUD:" -Foreground Green
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in Netgear ReadyCLOUD directory if it exists
if ($UseReadyCLOUD) {Add2Log "CONFIG: UseReadyCLOUD is set to $UseReadyCLOUD"}
if ($UseReadyCLOUD -and (Test-Path $env:USERPROFILE\ReadyCLOUD))
   {
    $SavePath = "$env:USERPROFILE\ReadyCLOUD\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to READYCLOUD:" -Foreground Green
    Write-PackagesConfig
   }

# Backup Chocolatey package names on local computer to packages.config file in Resilio Sync directory if it exists
if ($UseResilioSync) {Add2Log "CONFIG: UseResilioSync is set to $UseResilioSync"}
if ($UseResilioSync -and (Test-Path "$env:USERPROFILE\Resilio Sync"))
   {
    $SavePath = "$env:USERPROFILE\Resilio Sync\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to RESILIO SYNC:" -Foreground Green
    Write-PackagesConfig
   }   

# Backup Chocolatey package names on local computer to packages.config file in Seafile directory if it exists
if ($UseSeafile) {Add2Log "CONFIG: UseSeafile is set to $UseSeafile"}
if ($UseSeafile -and (Test-Path $env:USERPROFILE\Documents\Seafile))
   {
    $SavePath = "$env:USERPROFILE\Seafile\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to SEAFILE:" -Foreground Green
    Write-PackagesConfig
   }
   
# Backup Chocolatey package names on local computer to packages.config file in TonidoSync directory if it exists
if ($UseTonidoSync) {Add2Log "CONFIG: UseTonidoSync is set to $UseTonidoSync"}
if ($UseTonidoSync -and (Test-Path $env:USERPROFILE\Documents\TonidoSync))
   {
    $SavePath = "$env:USERPROFILE\Documents\TonidoSync\$SaveFolderName\$env:COMPUTERNAME"
	Write-Host "  ** Saving to TONIDO SYNC:" -Foreground Green
    Write-PackagesConfig
   }

##### SAVE BACKUPS END
##### WRAP UP

# Run post-processor if configured
if ($PostProcessScript) {
	Add2Log "CONFIG: PostProcessScript is set to `"$PostProcessScript`""
	Add2Log "RUNNING: $PostProcessScript"
	&$PostProcessScript
	}

if ($ICinstalled){
     Write-Host "To re-install your Chocolatey packages: run INSTCHOCO -Y`n" -Foreground Magenta
   } else {
     Write-Host "  ** Consider getting InstChoco - The ULTIMATE Chocolatey and Chocolatey packages (re)installer!`n  ** https://community.chocolatey.org/packages/instchoco`n" -Foreground Cyan
     Write-Host "To re-install your Chocolatey packages: run CHOCO INSTALL PACKAGES.CONFIG -Y`n" -Foreground Magenta
   }
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
if (Test-Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"){
   Write-Output "$(Get-Date) Choco-Package-List-Backup FINISHED" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-package-list-backup.log"
}
Start-Sleep -s 10 # Gives time to view before closing when run from Windows Start Menu shortcut
tools\ChocolateyInstall.ps1
$ErrorActionPreference = 'Stop'
$packageName      = 'choco-package-list-backup'
$toolsDir         = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$pp               = Get-PackageParameters
$scriptDir        = "$(Get-ToolsLocation)\BCURRAN3"
$script           = 'choco-package-list-backup.ps1'
$ScriptConfig     = 'choco-package-list-backup.config'
$shortcutName     = 'Chocolatey Package List Backup.lnk'
$oldshortcutName  = 'Choco Package List Backup.lnk'
$altshortcutName  = 'Package List Backup.lnk'
$Date             = Get-Date -UFormat %Y-%m-%d

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

# Migration
# Move files before v2019.08.27 from old to new storage location
if (Test-Path "$env:ChocolateyInstall\bin\$script") { Remove-Item "$env:ChocolateyInstall\bin\$script" -Force }
if (Test-Path "$env:ChocolateyInstall\bin\choco-package-list-backup.xml") { Rename-Item "$env:ChocolateyInstall\bin\choco-package-list-backup.xml" $ScriptConfig -Force }
if (Test-Path "$env:ChocolateyInstall\bin\$ScriptConfig") { Move-Item "$env:ChocolateyInstall\bin\$ScriptConfig" "$scriptDir" -Force ; $Migration=$True }
if ($Migration) { &SchTasks /Delete /TN choco-package-list-backup /F }
if (Test-Path "$scriptDir\choco-package-list-backup.cmd") { Remove-Item "$scriptDir\choco-package-list-backup.cmd" -Force }
if (Test-Path "$scriptDir\choco-package-list-backup-manual.bat") { Remove-Item "$scriptDir\choco-package-list-backup-manual.bat" -Force }
if (Test-Path "$scriptDir\CPLB.cmd") { Remove-Item "$scriptDir\CPLB.cmd" -Force }

# Install Script
# Move new files and support files (if applicable)
Move-Item "$toolsDir\$script" "$scriptDir" -Force
Move-Item "$toolsDir\CPLB.bat" "$scriptDir" -Force
if (!(Test-Path "$scriptDir\$ScriptConfig")) { Move-Item "$toolsDir\$ScriptConfig" "$scriptDir" -Force }

# Create "shim"
Install-ChocolateyPowershellCommand -PackageName 'choco-package-list-backup' -PSFileFullPath "$scriptDir\$script"

# Cleanup
Remove-Item "$toolsDir\choco-package-list-backup.*" -Force -ErrorAction SilentlyContinue | Out-Null
if ($env:Path -NotMatch "BCURRAN3"){ Install-ChocolateyPath "$scriptDir" "Machine" ; refreshenv }

Function Update-Config{
[xml]$UpdatedConfig = Get-Content "$scriptDir\$ScriptConfig"

$UseiCloudDrive = $UpdatedConfig.Settings.Preferences.UseiCloudDrive
if ($UseiCloudDrive -eq $null)
   {
    Write-Host "  ** Adding iCloudDrive support to $ScriptConfig." -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 $ScriptConfig." -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 $ScriptConfig." -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 $ScriptConfig." -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "AllProgramsListFile", $null)
    $NewStuff.InnerText=("AllProgramsList.txt") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }   
$SaveTitleSummary = $UpdatedConfig.Settings.Preferences.SaveTitleSummary
if ($SaveTitleSummary -eq $null)
   {
    Write-Host "  ** Adding SaveTitleSummary support to $ScriptConfig." -Foreground Magenta
	$NewStuff=$UpdatedConfig.CreateNode("element", "SaveTitleSummary", $null)
    $NewStuff.InnerText=("false") 
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$DefaultUserProfile = $UpdatedConfig.Settings.Preferences.DefaultUserProfile
if ($DefaultUserProfile -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "DefaultUserProfile", $null)
    if ($env:COMPUTERNAME -eq $env:USERNAME.trim('$')) { $NewStuff.InnerText=('Public') } else { $NewStuff.InnerText=("$env:USERNAME") }
    Write-Host "  ** Adding DefaultUserProfile support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$UseDefaultUserProfile = $UpdatedConfig.Settings.Preferences.UseDefaultUserProfile
if ($UseDefaultUserProfile -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "UseDefaultUserProfile", $null)
    $NewStuff.InnerText=("false") 
    Write-Host "  ** Adding UseDefaultUserProfile support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$CustomPath2 = $UpdatedConfig.Settings.Preferences.CustomPath2
if ($CustomPath2 -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "CustomPath2", $null)
    $NewStuff.InnerText=("c:\backup") 
    Write-Host "  ** Adding CustomPath2 support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$UseCustomPath2 = $UpdatedConfig.Settings.Preferences.UseCustomPath2
if ($UseCustomPath2 -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "UseCustomPath2", $null)
    $NewStuff.InnerText=("false") 
    Write-Host "  ** Adding UseCustomPath2 support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$SaveArguments = $UpdatedConfig.Settings.Preferences.SaveArguments
if ($SaveArguments -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "SaveArguments", $null)
    $NewStuff.InnerText=("false") 
    Write-Host "  ** Adding SaveArguments support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$PreProcessScript = $UpdatedConfig.Settings.Preferences.PreProcessScript
if ($PreProcessScript -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "PreProcessScript", $null)
    $NewStuff.InnerText=("false") 
    Write-Host "  ** Adding PreProcessScript support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }
$PostProcessScript = $UpdatedConfig.Settings.Preferences.PostProcessScript
if ($PostProcessScript -eq $null)
   {
	$NewStuff=$UpdatedConfig.CreateNode("element", "PostProcessScript", $null)
    $NewStuff.InnerText=("false") 
    Write-Host "  ** Adding PostProcessScript support to $ScriptConfig." -Foreground Magenta
	$UpdatedConfig.Settings.Preferences.AppendChild($NewStuff) | Out-Null
	$UpdatedFile = $True
   }   
if ($UpdatedFile)
   {   
    $UpdatedConfig.Save("$scriptDir\$ScriptConfig")
	Write-Host "  ** Updated $ScriptConfig" -Foreground Magenta
   }
}

Update-Config

# exit if a scheduled task is not wanted
if ($pp["NOTASK"] -eq 'true' -or $pp["NOSCHEDULE"] -eq 'true'){
       Write-Host "  ** NOTASK or NOSCHEDULE specified, not installing scheduled task." -Foreground Magenta
	   exit
   }
   
# install option to not run the script after install
$RunAfterInstall = $True
if ($pp["NORUN"] -eq 'true' -or $pp["DONTRUN"] -eq 'true'){
       Write-Host "  ** NORUN or DONTRUN specified, not running task." -Foreground Magenta
	   $RunAfterInstall = $False
   }

$ErrorActionPreference = 'SilentlyContinue'
$GotTask = (&schtasks /query /tn choco-package-list-backup) 2> $null
$ErrorActionPreference = 'Stop'

# Change task to run new batch file and keep other existing settings (2020.04.06 upgrade)
if ($GotTask -ne $null){
     &SchTasks /CHANGE /TN "choco-package-list-backup" /TR "%ChocolateyInstall%\bin\choco-package-list-backup.bat"
   }

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 "`nKeeping existing scheduled task and upgrading script files." -Foreground Magenta
  } else {
    # install option to run at boot
    if ($pp["ONSTART"] -eq 'true' -or $pp["ATSTARTUP"] -eq 'true'){
	      SchTasks /Create /SC ONSTART /DELAY 0002:00 /RU SYSTEM /RL HIGHEST /TN "choco-package-list-backup" /TR "%ChocolateyInstall%\bin\choco-package-list-backup.bat" /F
          Write-Host "  ** ONSTART or ATSTARTUP specified, task will run on boot." -Foreground Magenta		  
       } else {
		 # Default install scheduled task 
	     SchTasks /Create /SC WEEKLY /D MON /RU SYSTEM /RL HIGHEST /TN "choco-package-list-backup" /TR "%ChocolateyInstall%\bin\choco-package-list-backup.bat" /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
	    }
    }
	
# Additional defaults for Windows 10+ computers
if (Get-IsWin10){
    $TaskSettings=New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
    Set-ScheduledTask -TaskName choco-package-list-backup -Settings $TaskSettings | Out-Null
}
	
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:ChocolateyInstall\bin\choco-package-list-backup.bat" -IconLocation "$env:ChocolateyInstall\choco.exe" -WorkingDirectory "$env:ChocolateyInstall\bin\"
    } else {
      Install-ChocolateyShortcut -shortcutFilePath "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\$shortcutName" -targetPath "$env:ChocolateyInstall\bin\choco-package-list-backup.bat" -IconLocation "$env:ChocolateyInstall\choco.exe" -WorkingDirectory "$env:ChocolateyInstall\bin\"
	}

If ($RunAfterInstall){
	Write-Host "Running Choco-Package-List-Backup.ps1 to create backup(s)..." -Foreground Magenta
    &$env:ChocolateyInstall\bin\choco-package-list-backup.bat
   }
Write-Host "ADDITIONAL INFORMATION:" -Foreground Magenta
Write-Host "  ** Customize your backups: run CHOCO-PACKAGE-LIST-BACKUP -EDITCONFIG." -Foreground Magenta
Write-Host "  ** Run from Command Prompt or PowerShell: CHOCO-PACKAGE-LIST-BACKUP or CPLB." -Foreground Magenta
If (Test-Path "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Chocolatey"){
     Write-Host "  ** Run from Windows: Click Package List Backup in the Start Menu under Chocolatey to run." -Foreground Magenta
   } else {
     Write-Host "  ** Run from Windows: Click Chocolatey Package List Backup in the Start Menu to run." -Foreground Magenta
   }
tools\ChocolateyUninstall.ps1
$ErrorActionPreference = 'Stop'
$packageName     = 'choco-package-list-backup' 
$scriptDir       = "$(Get-ToolsLocation)\BCURRAN3"
$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: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
Remove-Item "$ENV:ChocolateyInstall\bin\choco-package-list-backup.bat" -Force -ErrorAction SilentlyContinue
Remove-Item "$scriptDir\choco-package-list-backup.*" -Force -ErrorAction SilentlyContinue | Out-Null
Remove-Item "$scriptDir\CPLB.bat" -Force -ErrorAction SilentlyContinue | Out-Null
if (!(Get-ChildItem -Path "$scriptDir" | Measure-Object | %{$_.Count})) {
    $ENV:Path.Replace("$scriptDir","") | Out-Null
    Remove-Item "$scriptDir" | Out-Null
   }
tools\CPLB.bat
@echo off
%ChocolateyInstall%\bin\choco-package-list-backup.bat %1

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 2563 Tuesday, June 6, 2023 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2023.6.2-pre 56 Saturday, June 3, 2023 Exempted
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2023.05.13-pre 49 Saturday, May 13, 2023 Exempted
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2022.02.06 10810 Sunday, February 6, 2022 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.09.25 5989 Sunday, September 26, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.09.22 1547 Wednesday, September 22, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.05.10 5442 Tuesday, May 11, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.04.08 3230 Friday, April 9, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.22 3420 Tuesday, March 23, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.15 2342 Monday, March 15, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2021.03.14 226 Sunday, March 14, 2021 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2020.04.06 5924 Monday, April 6, 2020 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.08.27 5819 Tuesday, August 27, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.07.02 3927 Tuesday, July 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.06.27 196 Tuesday, July 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.31.01 2247 Saturday, February 9, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.31 904 Friday, February 1, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.29 637 Tuesday, January 29, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.24 727 Friday, January 25, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.04 902 Friday, January 4, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2019.01.02 581 Wednesday, January 2, 2019 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2018.08.23 1536 Friday, August 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script + Task) 2018.06.21 958 Friday, June 22, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.19 808 Saturday, May 19, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.17 466 Thursday, May 17, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.09 547 Wednesday, May 9, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.05.06 462 Sunday, May 6, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.25 547 Thursday, April 26, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.24.01 480 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.24 338 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.04.23 378 Tuesday, April 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.02.24 759 Saturday, February 24, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.02.12 475 Tuesday, February 13, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2018.01.29 363 Tuesday, January 30, 2018 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2017.12.17 563 Monday, December 18, 2017 Approved
(unofficial) Choco Package List Backup to Local and Cloud (Script) 2017.08.19 865 Sunday, August 20, 2017 Approved

  • 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 save package title and summary information or not (default=false)
    4. configure to append a date to the saved packages.config, AllProgramsList.txt, and pins.bat files(default=false)
    5. configure what folder to save to (default=ChocolateyPackageListBackup)
    6. easily add a custom location by editing CustomPath and UseCustomPath in the .config file
    7. configure to save a list of all your installed Windows programs whether installed by Chocolatey or not to AllProgramsList.txt (default=true)

OPTIONAL INSTALLATION INSTRUCTIONS:

  • choco install choco-package-list-backup --params "'/ONSTART:TRUE'" - scheduled task to run at boot instead of at a scheduled time
  • choco install choco-package-list-backup --params "'/NOTASK:TRUE'" - won't configure a scheduled task
  • choco install choco-package-list-backup --params "'/NORUN:TRUE'" - won't run the script upon install (let's you configure before first run)

INSTRUCTIONS:

  • Edit C:\tools\BCURRAN3\choco-package-list-backup.config to customize your backup(s). It's easy, there are comments. Run CPLB or CHOCO-PACKAGE-LIST-BACKUP -EditConfig
  • From PowerShell or the Command Prompt, type CPLB or CHOCO-PACKAGE-LIST-BACKUP 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:

  • 2023.06.28 - Now compatible with Chocolatey alpha/beta/delta/epsilon/zeta/eta/theta/iota/kappa/lambda/mu/nu/xi/omicron/pi/rho/sigma/tau/upsilon/phi/chi/psi/omega versions. New -ViewLog option. Added detailed logging. Minor changes to arrangement, flow, cosmetics, and comments.
  • 2023.06.02 - Added Chocolatey 2.0 compatibility, added new defaults for Win10+ computers to AllowStartIfOnBatteries, DontStopIfGoingOnBatteries, StartWhenAvailable
  • 2022.02.06 - All existing files now renamed with .bak before creating new versions. This backup is useful during migrations where the files could get overwritten during install of CPLB on a new computer. (https://github.com/bcurran3/ChocolateyPackages/issues/285)
  • 2021.09.25 - Improved OneDrive support while running under SYSTEM and handling of a missing config file.
  • 2021.09.22 - Add Box Drive support. Add defaults incase of corrupt or missing choco-package-list-backup.config. Add new ONSTART and ATSTARTUP paremeters to run at boot instead of a scheduled time.
  • 2021.05.10 - Speed optimations by TheCakeIsNaOH - Thanks!
  • 2021.04.08 - Fixed missing UseCustomPath2 variable import. Thanks matteotrubini! Removed duplication of "shim" creation.
  • 2021.03.22 - Added 2nd custom path option, added saved arguments option thanks to TheCakeIsNaOH, added pre and post processing option
  • 2021.03.15 - Added NORUN/DONTRUN install option (choco install choco-package-list-backup --params "'/NORUN:TRUE'".)
  • 2021.03.14 - Fixed wrong command in scheduled task. Fixed saving to C:\Users\Public\Documents. Fixed problem when SaveTitleSummary is set to true and there is no chocolatey.nuspec file to get values from. Added ability to set default user profile. Added start/finished logging. Added NOTASK/NOSCHEDULE install option (choco install choco-package-list-backup --params "'/NOTASK:TRUE'".) Minor other changes.
  • 2020.04.06 - Better error handling when $env:ChocolateyToolsLocation is not defined. (Usually due to running under a different account than installed from.)Acronymized CPLB.cmd added for command line running.
  • 2019.08.27 - Can now put title and summary info into the packages.config file, new -EditConfig parameter to edit the config file, Now works from Command Prompt as well as PowerShell, script installation endpoint changed, config file renamed from .xml to .config
  • 2019.07.02 - Now saves OneDrive backups to free, paid, and corporate folders
  • 2019.06.27 - Now backups the config file, can now also make archival versions of pins.bat, edited config comments to not add quotes to custom path.
  • 2019.01.31 - File saving functions re-written and optimized, check for errors caused by other Chocolatey instances
  • 2019.01.29 - Fixed bug where iCloudDrive preference wasn't checked correctly, thanks sandscap-sc!
  • 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)
  • 2017.08.19 - initial release

ROADMAP:

  • Possibly convert to use regkey install path for each supported program
  • Add other cloud services support by request
  • I'm open to suggestions - open a GitHub issue please.
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