---
title: Chocolatey
kind: note
description: package manager for Windows
words: 141
readingMinutes: 1
created: '2024-07-29T20:23:30+02:00'
updated: '2025-07-28T10:40:31+02:00'
website: https://chocolatey.org/
---
## Link

<https://chocolatey.org/>

# Notes
[apt](/notes/debian)-like package installer for [Windows](/notes/microsoft-windows) with a [community repository](https://community.chocolatey.org/packages) and a commercial on-premises solution
# Resources
- [My Packages](https://community.chocolatey.org/account/Packages) (works only when signed in)
- [My Packages](https://github.com/cconrad/chocolatey-packages)
- [chocolatey-community/chocolatey-package-requests](https://github.com/chocolatey-community/chocolatey-package-requests/issues)
- Community Validation Extension - validate your packages BEFORE pack and push
  ![Before you continue to YouTube](https://www.youtube.com/live/AQTIycbA3Jo)
# FAQ
## Back up list of installed apps
```powershell filename=claus10-chocolatey.ps1
C:\ProgramData\chocolatey\bin\choco.exe list -li > C:\Users\mail\OneDrive\Backup\claus10\chocolatey\$(date -Format "yyyyMMdd").txt
```
### Automate the backup using a scheduled task
Save the code above in a script file. Adjust the paths (to the script and target directory) below. Run these commands to register a scheduled task.
```powershell
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-WindowStyle Hidden C:\Users\mail\Sites\administration\backup\claus10-chocolatey.ps1"

$trigger = New-ScheduledTaskTrigger -Daily -At '20:20'

$settings = New-ScheduledTaskSettingsSet -RunOnlyIfNetworkAvailable -MultipleInstances IgnoreNew -ExecutionTimeLimit (New-Timespan -Minutes 1)

$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings -Description "Back up list of installed apps"

Register-ScheduledTask -TaskName "Backup Chocolatey" -InputObject $task
```
## Maintain [Windows](/notes/microsoft-windows) packages from [Fedora](/notes/fedora-linux)
```shell
podman run --rm -it -v .:/root:z docker.io/chocolatey/choco:latest choco pack
podman run --rm -it -v .:/root:z docker.io/chocolatey/choco:latest choco push -s https://push.chocolatey.org/ --api-key API_KEY
```
## Test packages using a [GCP](/notes/google-cloud) VM and their [CLI](/notes/cli) [Docker](/notes/docker) image
1. If necessary, [log in](/notes/google-cloud#logging-in)
2. Create a VM that self-terminates after max. 1 hour:
	```shell
	podman run -ti --volumes-from gcloud-config gcr.io/google.com/cloudsdktool/google-cloud-cli:stable gcloud compute instances create test-choco --project=api-project-542389980451 --zone=europe-north1-c --machine-type=e2-medium --network-interface=network-tier=STANDARD,stack-type=IPV4_ONLY,subnet=default --no-restart-on-failure --maintenance-policy=TERMINATE --provisioning-model=SPOT --instance-termination-action=DELETE --max-run-duration=3600s --no-service-account --no-scopes --create-disk=auto-delete=yes,boot=yes,device-name=choco-xmind-2020,image=projects/windows-cloud/global/images/windows-server-2022-dc-v20240913,mode=rw,size=50,type=pd-balanced --shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
	```
	- Remove `--provisioning-model=SPOT` above if you want the VM to be guaranteed to last for a full hour, at slightly higher cost
3. Set the Windows password:
	```shell
	podman run -ti --volumes-from gcloud-config -e APT_PACKAGES='openssl' gcr.io/google.com/cloudsdktool/google-cloud-cli:stable gcloud compute reset-windows-password test-choco --project=api-project-542389980451 --quiet --zone=europe-north1-c
	```
4. Connect to it using <span class="dead-link">RDP</span>:
	```shell
	rdesktop ...
	```
