{ claus.conrad }

Chocolatey

https://chocolatey.org/

Notes

apt-like package installer for [Windows](…/Microsoft Windows/) with a community repository and a commercial on-premises solution

Resources

FAQ

Back up list of installed apps

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.

$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 packages from Linux

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](…/Google Cloud/) VM and their CLI Docker image

  1. If necessary, [log in](…/Google Cloud/#Logging in)
  2. Create a VM that self-terminates after max. 1 hour:
    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:
    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 RDP:
    rdesktop ...