Automate Windows Software and Apps' installation!

Manager — SDE
Search for a command to run...

Manager — SDE
No comments yet. Be the first to comment.
← Previous: What’s New in the SDK and Tooling for .NET 9 .NET Aspire is a set of tools, templates, and packages designed to help developers build observable, production-ready apps that embrace cloud-native and distributed computing best practices. .N...

← Previous: What’s New in .NET Libraries for .NET 9 The .NET 9 SDK introduces several new capabilities and improvements to streamline development workflows, enhance build and test experiences, improve NuGet security and performance, and provide great...

← Previous: What’s New in .NET MAUI for .NET 9 .NET 9 adds a wide range of enhancements and new APIs across the base class libraries. These improvements touch everything from low-level data structures and cryptography to JSON serialization, text pr...

← Previous: What’s New in ML.NET .NET Multi-platform App UI (.NET MAUI) in .NET 9 focuses on improving overall product quality, test coverage, performance, and stability. While previous releases introduced major new capabilities and controls, the emp...

← Previous: What’s new in ASP.NET Core 9.0 ML.NET continues to evolve as a full-featured, open-source machine learning framework for .NET developers, enabling you to create, train, and deploy custom ML models directly in your .NET applications. ML....

If you've installed Windows enough times, you already know the pain of installing all your Software and Apps again and again. If you haven't, let me save you the pain and show you how to:
Automate the installation of Windows Software and Apps
What we need here is something called Package Manager, which we can give some commands and it would install the software from the command line itself.
Why command line — so that we can repeat the process.
Windows doesn't have an official Package Manager yet, but Chocolatey is your safest bet.
Windows has gotten
wingetbut it's relatively new and community support/references are much better for Chocolatey.
So here's what we're going to do, we need to search and list down all the software that we typically install and save that command at a place where we can refer it later. It can be on any of Drives (Google Drive, OneDrive) or if you're a developer or power user (whatever that is) - on a Git repo. I don't care, as long as you have access to it when the time comes.
So let's get to it.
From an Admin terminal (PowerShell or Windows Terminal)
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
If you are already familiar with the package names of individual Software or the App, you can skip this otherwise you can search
Let's say I don't know what is the name of the Node.js package. I can search:
choco search nodejs
It should return results something like that:
nodejs 16.11.0 [Approved]
nodejs.commandline 6.11.0 [Approved]
nodejs.install 16.11.0 [Approved]
nodejs-lts 14.18.0 [Approved]
...
30 packages found.
Homework: What does
[Approved]mean?
Visit https://community.chocolatey.org/packages to find all the supported packages. You can find all sorts of amazing Software and Apps including day-to-day software like Chrome, Zoom, and iTunes - to Enterprise Developer Tools like Visual Studio, Python, Azure and AWS CLI - and whatnot.
This is how you install a package. From an Admin terminal:
choco install nodejs-lts
choco install vscode
Now you can save all this in a file and install, but wait "where is the automation you promised? I need my money back." Don't worry, people way smarter than me have thought about this and come up with:
There's an official way to list all the packages and install from that file.
Here's what a typical package looks like:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="vscode" />
<package id="nodejs-lts" version="14.18.0" />
</packages>
Save this file and in future you can install all the Software and Apps. e.g.
choco install "sample-packages.config"
Since I already have these packages installed, I got the following message, but you can figure it out from here.
Installing from config file:
sample-packages.config
By installing, you accept licenses for the packages.
Installing the following packages:
vscode
nodejs-lts
vscode v1.61.0 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
nodejs-lts v14.18.0 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
Chocolatey installed 0/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
That's it! This is how you can automate the installation of your favourite Software and Apps in a repeatable way.
If you liked this, please like and share this post. And visit https://github.com/iSatishYadav/AutomateWindowsSoftwareInstallation and give this repo a star.
Originally posted at:
https://blog.satishyadav.com/automate-new-windows-machine-installation
Happy Hacking!