BelgianCoder
BelgianCoder’s story time

BelgianCoder’s story time

Setup your Windows computer faster than ever

Setup your Windows computer faster than ever

by using Chocolatey and PowerShell

BelgianCoder's photo
BelgianCoder
·Mar 19, 2022·

6 min read

Play this article

Tired of scouring the internet to collect setups for every application you want to install? Do you really like to sit and wait for installations to complete like you are paid an hourly rate? Have you seen snails crawl faster than your progress bar? The good news is, you don't need to sit and wait anymore! Just follow along and break the cycle of patience and coffee breaks.

What will we learn?

Let's say you just came into possession of a brand-new computer. You just installed Windows, or the computer was already pre-installed out of the box. A freshly installed computer is actually pretty boring without some additional applications to fill the void. Think about Office, a video player with codecs, your favorite browser, the sky is the limit. Actually, packages are the limit but more on that later.

Who is this for?

Because you're watching this channel, chances are that you have an above average interest or knowledge about computers. Your skill level doesn't matter, everything will be explained step by step. If you are not interested in the technical details but are eager to save some time, just check out the execution chapter. People who often install or reinstall computers will benefit the most.

La raison d'être

Application development, or at least an attempt to, is a large part of my life. To be as productive as possible, I often use specific applications and workflows. Meaning I install a lot of different applications. Every application needs to be downloaded and installed, one after the other. Clicking and filling out information into those pesky wizards like a mindless application addict, waiting for the next fix.

To be fair I'm hardly the first one to create a script like this. You can find a lot of GitHub repositories with scripts that are even larger and more complex. The scripts we use in this guide uses a lot of ideas from other people and were adapted to better fit my personal needs. My intention was to setup my development environments, install applications that I use frequently and change some Windows parameters while we're at it.

Benefits

There are a few benefits you need to consider:

  • Write once, reuse many times. This translates into less work in the long run and more spare time to do fun things.
  • Make your setup monkey-proof. No more panic when you're offline because you need THAT one application and you forgot to install it.
  • Setup different systems in the same manner. Re-create your setup easily in a Virtual Machine or on a desktop and a notebook. Great for testing and consistency.
  • Customize whatever you want, however you want. If you can find or create a script for it, you can reap the benefits.

Script contents

All files can be found on my GitHub by clicking here. To be fair, the scripts are tailored to my personal needs and with Windows 11 Pro or higher in mind. A few examples of the content of the scripts at the time of writing:

  • Windows tweaks and configuration, disable telemetry, disable Bing search in start menu, customize UI, add Windows features, Enable Windows developer mode and a lot of other things.
  • Bloatware removal.
  • Chocolatey package manager setup.
  • Install SDKs like Python (Anaconda).
  • Install Docker.
  • Install lots of other applications.
  • Update PowerShell.
  • Install Visual Studio Code extensions.
  • Install and configure Windows Subsystem for Linux (WSL) with Ubuntu 20.04 LTS including memory limitation configuration.
  • Set some applications to open in admin mode by default.
  • Create a Windows Terminal shortcut with elevated privileges, ready to be pinned to the taskbar.
  • Windows Defender exclusions for development environments.
  • Node version manager, makes it possible to use multiple NodeJS versions on the same machine.

Building blocks

01_Sophia-Script

The first folder contains a script that I found on this Github. It's amazing how much hard work went into this solution. Not only does it support Windows 10 and 11, but also PowerShell 5 and PowerShell 7. As a bonus, they've built a graphical user interface to configure all parameters. When you are done configuring the options, you can run the script from the interface or export your configuration to a file that you can re-import later. This makes it very easy to create multiple profiles for notebook, desktop, server and other configurations.

02_Tweaks_And_Packages

As the name suggest, this script is responsible for tweaking your Windows configuration. Optimizing your user experience while daily driving your machine. One of the most important items in this script is the installation of Chocolatey. Chocolatey is a package manger, enabling you to install and update software with single line commands. After the installation of Chocolatey completes, a few different packages will be installed just by executing choco install [packageName]. If you want your software up to date, you can uncomment the Create daily task to update chocolatey packages. Just be aware this can create issues due to updates to applications that will introduce bugs. WSL installation was introduced in this script early on, but I would recommend using the GUI of the Sophia-script because of additional configuration parameters. Finally, all your desktop icons will be deleted. Clean desk anyone? And start menu tiles will be unpinned so you don’t have to remove them yourself. Do keep in mind that the script will reboot your computer after finishing.

03_Extensions_And_configuration

Most of this script will be development related. Like installing Visual Studio Code extensions or fixing the WSL kernel massive memory usage. Shortcuts will be created that are configured to automatically open in admin mode. Something we need a lot for developing applications. Unfortunately, pinning shortcuts to the taskbar is not possible at this time.

Next, a lot of processes and paths are added to the Windows Defender exclusions. You can define your custom project paths to exclude them as well. This will prevent Windows Defender to hog all your resources, leaving more for compiling or debugging applications. I’ve also found a helpful script that will disable Windows Defender for Linux installations through WSL. NVM installation will be the last step of the script. NVM is a handy little tool that let’s you install multiple node versions and switch between them as you like.

Modules

The files or in this case file is purely used for code reusability. In the Functions.psm1 you will find functions that will help abstract complexity and are used as a foundation for some of the other scripts.

Execution

The repository contains different folders, a few of them are prefixed with a number. It’s important that you execute the scripts in that same order. Just skip folders that do not start with a number, these contain helper files for sharing code. It’s also very important that you have read the introduction and changed the execution policy beforehand as stated in the introduction. Also, always start PowerShell with elevated privileges before executing the script. The Sophia Script can be started by navigating to /01_Sophia-Script/Wrapper/ and executing the SophiaScriptWrapper.exe file. Executing the other scripts can be done through PowerShell by navigating to the correct root directory where you extracted the files downloaded from the GitHub repository. for example: set-location F:\Projects\. If you want to execute a script just start the command with a .. To execute the 2nd script, you can type .\02_Tweaks_And_Packages\tweaks_and_packages.ps1 and confirm by pressing enter. Now just sit back and let the magic happen.

Customization

Be aware that parts of the script will break due to changes in Windows, and I will not actively maintain this repository. Feel free to add other scripts, remove parts, change the list of applications to install, just customize the script to your liking. Start cutting down your time spent on setup and enjoy the experience.

 
Share this