Wednesday, March 13, 2024

Setting up a new machine with WinGet DSC - my experience

TLDR (for Clint 😜)

  • Mostly positive, would recommend
  • Dev Home still crashes lots - but it is in preview, so I'll let it off
  • My scripts are at
  • Many sample config scripts (from the official repo) wouldn't run (failed) for me :( 
  • VS doesn't like me.

Last year, I heard a lot about Desired State Configuration (DSC) and how it could now be used with WinGet to set up Windows PCs.

I took a casual interest as I rarely (less than once a year) have to set up a PC. I have my own checklist for when I do need to set up a machine, but I normally do it by looking at what's currently installed on another machine. I like the idea of being able to rebuild a machine quickly, but historically, I've found it difficult and couldn't justify the time to investigate and set it up.

Then, circumstances changed.

One morning, I came to my laptop (a Surface Book 2) to find that overnight, it had automatically installed an update and restarted, and now the keyboard wasn't recognized. 
It wasn't a cheap machine, and it was of a high specification that was still sufficient for my needs, but at about 5 years old, I was aware it was going to need replacing eventually.

After about a day of faffing and so many reboots that I lost count, I got things partially working again, but I deemed it time to get a replacement.

When the new machine arrived, I decided to automate the configuration as much as possible. 

For my own benefit (& possible future reference), out of interest, and because it may also be useful to you, here's how it went:

  • Set up the new laptop with the basic wizard and not importing anything from an existing backup.
  • Installed all available updates from Windows Update
  • Used Microsoft365 (already installed on machine) to install Office.
  • OneDrive already installed on the machine and didn't need to set that up
  • Installed Dev Home from the store (using as searching in the store didn't find it 😢)
  • Updated App Installer (as prompted by Dev Home)
  • Created a Dev Drive (500GB & accepted the defaults)
  • Cloned mrlacey/my-config into the new dev drive
  • Used Dev Home to run the config files from the cloned repo
  • This is where the fun began. It wasn't exactly smooth sailing.
  • I copied some machine configuration settings from the official samples, but most of them failed with vague and unhelpful errors. I made most of those changes manually instead.
"The configuration unit was not in the module as expected." - whatever that means?
  • I couldn't find a way to enable my preferred accessibility settings via a DSC file :'(
  • I used another config file (which I manually created) to install a number of apps I use regularly. Most of these worked but one app didn't. It seems I got confused by the difference between "winget list" and "winget search". Once I figured out that difference, I got everything working.
  • Then, I tried setting up Visual Studio. To keep it simple, I only tried to install 2 versions: VS2022 Enterprise & VS2022 Enterprise Preview. (I like to have the preview version for testing my extensions against the latest builds. In theory, this helps me get earlier detection and fixes for any breaks or incompatibilities.) As I use (and make) a lot of extensions, I wanted to make use of the new ability to specify extensions as part of a vsconfig file. While trying to use DSC, I kept getting failures with no error details, so I gave up that approach and tried to use the Visual Studio installer to import the VSConfig file I had exported on another machine and then manually updated it to add more extension entries. After much experimentation (and an eventful side quest) I found a limitation in the type of extensions that vsconfig supports. So, I manually edited the vsconfig file so the VSInstaller could successfully run it. However, it still failed to work as part of the DSC file.
  • The final VS-related step was to manually install all the extensions that VSConfig didn't support.
  • Then, I added my email details to Outlook...which is always more challenging than I feel it should be.
Next step:
  • Productive work...hopefully.

  • I'm glad to have been able to use this experience to better document how I can set up a new machine. If you're interested, these files are at
  • There are lots of opportunities for the experience to improve, but it looks promising. Better progress reporting and helpful error messages would be a good start. ("Applying settings from configuration file ..." as the only thing shown through all installation isn't very informative.)
  • Do I feel confident I'll be able to rebuild this new laptop quickly and easily? Not entirely. It should be easier next time, but I'm a long way from not needing a really good reason and a lot of time to hard reset this machine and start again.

I expect (and intend) to continue to update the files in my config repo so they reflect any other changes I make to the machine.

Aside: I lost count of how many times Dev Home crashed during the above :(


Post a Comment

I get a lot of comment spam :( - moderation may take a while.