{"id":1215,"date":"2026-11-23T02:04:05","date_gmt":"2026-11-23T02:04:05","guid":{"rendered":"https:\/\/windows-vps.org\/blog\/?p=1215"},"modified":"2026-11-23T02:04:05","modified_gmt":"2026-11-23T02:04:05","slug":"windows-vps-chocolatey-package-management","status":"publish","type":"post","link":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/","title":{"rendered":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script"},"content":{"rendered":"<div style=\"padding:20px\">\n<p>A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser, approving UAC prompts, and hoping the vendor page you found is the real one. Chocolatey turns that hour into a single script that runs the same way on every server you build.<\/p>\n<p>This article covers installing Chocolatey, building a package baseline that reflects a real Windows host, pinning versions so builds are reproducible, and running it unattended. For the hosting side, the <a href=\"https:\/\/windows-vps.org\/\">main site<\/a> covers which plans give you the disk and memory this workflow benefits from.<\/p>\n<h2>Why Package Management Belongs on a Windows Host<\/h2>\n<p>Manual installation does not scale and does not repeat. Two servers built a month apart end up with different versions of the same tool, and nobody can say which one is correct when a bug appears only on one.<\/p>\n<table border=\"1\" cellpadding=\"6\" cellspacing=\"0\">\n<tr>\n<th>Manual install<\/th>\n<th>Chocolatey baseline<\/th>\n<\/tr>\n<tr>\n<td>Versions vary per build<\/td>\n<td>Pinned versions, identical output<\/td>\n<\/tr>\n<tr>\n<td>Browser plus UAC clicks<\/td>\n<td>One unattended script<\/td>\n<\/tr>\n<tr>\n<td>No record of what was installed<\/td>\n<td>Package list in source control<\/td>\n<\/tr>\n<tr>\n<td>Hours on each new box<\/td>\n<td>Minutes, repeatable<\/td>\n<\/tr>\n<\/table>\n<p>Chocolatey plays the role apt or yum play on Linux: it wraps installers, handles unattended switches, and records installed packages in a local database under <code>C:\\ProgramData\\chocolatey<\/code>. That record is what makes a build auditable and a future upgrade predictable.<\/p>\n<p>It is not a substitute for a configuration management system. It handles packages, not file contents or registry state, and it is best used as one layer in a build pipeline rather than the whole pipeline.<\/p>\n<h2>Installing Chocolatey Non-Interactively<\/h2>\n<p>The install is a one-liner, but the surrounding choices matter. Run it from an administrator shell, allow TLS 1.2, and set the install directory and cache location before the first package lands.<\/p>\n<pre style=\"background:#f4f4f4;padding:10px\">[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\nSet-ExecutionPolicy Bypass -Scope Process -Force\niex ((New-Object System.Net.WebClient).DownloadString('https:\/\/community.chocolatey.org\/install.ps1'))\nchoco --version<\/pre>\n<p>The script installs the shim directory at <code>C:\\ProgramData\\chocolatey\\bin<\/code> and adds it to the machine PATH. Confirm <code>choco --version<\/code> works in a new shell before proceeding, because the PATH change does not reach an already-running session.<\/p>\n<h2>Configuring Sources, Proxy, and Cache<\/h2>\n<p>Most VPS builds pull from the community repository. If the host sits behind a proxy or a locked egress rule, configure it before the first install or every package download will fail.<\/p>\n<pre style=\"background:#f4f4f4;padding:10px\">choco config set proxy http:\/\/proxy.internal:8080\nchoco config set proxyUser svc_build\nchoco config set proxyPassword 'REDACTED'\nchoco config set cacheLocation D:\\choco-cache\nchoco source list<\/pre>\n<p>Move the cache off the system drive if the VPS has a separate data volume. Package downloads are large, and a full C: drive is the most common cause of a failed build that worked yesterday; the <a href=\"https:\/\/windows-vps.org\/contact\">contact page<\/a> covers storage sizing if you need a reference point.<\/p>\n<h2>Building a Baseline Package List<\/h2>\n<p>A good baseline covers the tools every server in your fleet needs, plus the runtimes specific to the workload. Group them into brackets so an IaaS web host does not get desktop-only tools it will never use.<\/p>\n<ul>\n<li>Core: <code>chocolatey-core.extension<\/code>, <code>chocolatey-compatibility.extension<\/code><\/li>\n<li>Runtime: <code>dotnet-8.0-runtime<\/code>, <code>dotnet-6.0-windowshosting<\/code> for IIS app pools<\/li>\n<li>Operations: <code>GoogleChrome<\/code> or <code>notepadplusplus<\/code> only on admin desktops, not servers<\/li>\n<li>Diagnostics: <code>sysinternals<\/code>, <code>curl<\/code>, <code>7zip<\/code>, <code>git<\/code><\/li>\n<li>Hosting: <code>iis-advanced-logging<\/code>, <code>urlrewrite<\/code>, <code>wincache<\/code> where applicable<\/li>\n<\/ul>\n<p>Keep the list in a file, not in the script, so it can be reviewed and diffed on its own. <code>packages.config<\/code> is the format Chocolatey itself uses for export and import, and it is plain enough to review in a code review with no tooling.<\/p>\n<p>Every package you add increases the surface that can break a build. The default answer to &#8220;should this be in the baseline&#8221; is no, unless the workload cannot run without it.<\/p>\n<h2>Pinning Versions for Reproducible Builds<\/h2>\n<p>Unpinned packages mean the build is different every time it runs. Pin the version for anything that carries a compatibility risk, and let the rest float only after you have verified the newest release.<\/p>\n<pre style=\"background:#f4f4f4;padding:10px\">choco install -y --no-progress --limit-output --pin --version 8.0.403 dotnet-8.0-runtime\nchoco pin list\nchoco pin remove --name dotnet-8.0-runtime<\/pre>\n<p>Pinning is a deliberate decision, not a default. A pinned package will not receive security updates, so review pins on a schedule and remove them once the newer version has been validated. The list of pins is a list of accepted risks, and it should stay short.<\/p>\n<p>Record the version numbers in the build log so you can answer &#8220;which build shipped the old runtime&#8221; a quarter later without reconstructing it from package timestamps.<\/p>\n<h2>The Baseline Script<\/h2>\n<p>The script wraps install, configuration, and verification. It should be safe to run twice: installs are idempotent, and a second run must not downgrade anything or reinstall what is already at the pinned version.<\/p>\n<pre style=\"background:#f4f4f4;padding:10px\">param([switch]$Upgrade)\nif (-not (Get-Command choco -ErrorAction SilentlyContinue)) { throw \"Chocolatey not installed\" }\nchoco install $PSScriptRoot\\packages.config -y --no-progress\nif ($Upgrade) { choco upgrade all -y --except-critical }\nchoco list --local-only | Out-File C:\\Admin\\choco-installed.txt<\/pre>\n<p>The <code>--except-critical<\/code> flag matters when upgrading in place: it excludes packages marked as critical, such as Chocolatey itself, from a bulk upgrade that could break the build mid-run. For a fresh build, run install only; for an existing host, run with <code>-Upgrade<\/code> during a window you control.<\/p>\n<p>Exit codes are the next layer of safety. Chocolatey returns 0 for success, 1641 for reboot required, and 3010 for reboot initiated. Treat those three as success in the wrapper and anything else as a build failure, with the log attached to the pipeline output.<\/p>\n<h2>Verification and Drift Control<\/h2>\n<p>A package manager is only as good as the verification around it. After the script runs, confirm the tools exist where you expect, that versions match the baseline, and that the host has not drifted since the last build.<\/p>\n<ul>\n<li><code>choco list --local-only --limit-output<\/code><\/li>\n<li><code>Get-Command git, 7z, curl | Select Name, Source<\/code><\/li>\n<li><code>compare-object (Get-Content build-baseline.txt) (Get-Content choco-installed.txt)<\/code><\/li>\n<li><code>Get-Content C:\\ProgramData\\chocolatey\\logs\\chocolatey.log -Tail 50<\/code><\/li>\n<\/ul>\n<p>Schedule the compare as a weekly task and alert on any difference that is not an approved upgrade. Drift is usually caused by someone installing a tool manually, which is exactly the behaviour the baseline exists to replace.<\/p>\n<p>Once the script is stable, it becomes the definition of a new server: provisioning means running one script and waiting. Treat the package list as code, review changes like code, and the build stays predictable even when the person building it has changed.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser, approving UAC prompts, and hoping the vendor page you found is the real one. Chocolatey turns that hour into a single script that runs the same way on &#8230; <a title=\"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script\" class=\"read-more\" href=\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\" aria-label=\"Read more about Automating Windows VPS Setup with Chocolatey: A Package Baseline Script\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1215","post","type-post","status-publish","format-standard","hentry","category-reviews"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Automating Windows VPS Setup with Chocolatey: A Package Baseline Script - Windows VPS Blog<\/title>\n<meta name=\"description\" content=\"A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script\" \/>\n<meta property=\"og:description\" content=\"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script\" \/>\n<meta property=\"og:url\" content=\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\" \/>\n<meta property=\"og:site_name\" content=\"Windows VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-23T02:04:05+00:00\" \/>\n<meta name=\"author\" content=\"windows-vps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@myxiechengxuan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"windows-vps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\",\"url\":\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\",\"name\":\"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script - Windows VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\"},\"datePublished\":\"2026-11-23T02:04:05+00:00\",\"author\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\"},\"description\":\"A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser,\",\"breadcrumb\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/windows-vps.org\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\",\"url\":\"https:\/\/windows-vps.org\/blog\/\",\"name\":\"Windows VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/windows-vps.org\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\",\"name\":\"windows-vps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"caption\":\"windows-vps\"},\"sameAs\":[\"https:\/\/windows-vps.org\/blog\",\"https:\/\/x.com\/myxiechengxuan\"],\"url\":\"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script - Windows VPS Blog","description":"A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/","og_locale":"en_US","og_type":"article","og_title":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script","og_description":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script","og_url":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/","og_site_name":"Windows VPS Blog","article_published_time":"2026-11-23T02:04:05+00:00","author":"windows-vps","twitter_card":"summary_large_image","twitter_creator":"@myxiechengxuan","twitter_misc":{"Written by":"windows-vps","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/","url":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/","name":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script - Windows VPS Blog","isPartOf":{"@id":"https:\/\/windows-vps.org\/blog\/#website"},"datePublished":"2026-11-23T02:04:05+00:00","author":{"@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58"},"description":"A freshly provisioned Windows VPS gives you a desktop with nothing on it. The next hour is usually spent downloading installers one by one from a browser,","breadcrumb":{"@id":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/windows-vps.org\/blog\/windows-vps-chocolatey-package-management\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/windows-vps.org\/blog\/"},{"@type":"ListItem","position":2,"name":"Automating Windows VPS Setup with Chocolatey: A Package Baseline Script"}]},{"@type":"WebSite","@id":"https:\/\/windows-vps.org\/blog\/#website","url":"https:\/\/windows-vps.org\/blog\/","name":"Windows VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/windows-vps.org\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58","name":"windows-vps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","caption":"windows-vps"},"sameAs":["https:\/\/windows-vps.org\/blog","https:\/\/x.com\/myxiechengxuan"],"url":"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/"}]}},"_links":{"self":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/comments?post=1215"}],"version-history":[{"count":1,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1215\/revisions"}],"predecessor-version":[{"id":1216,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/1215\/revisions\/1216"}],"wp:attachment":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/media?parent=1215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/categories?post=1215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/tags?post=1215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}