Windows 10/Windows 11 – Set Dark Mode Using MEM

More and more apps and operating systems support both light and dark mode settings. Dark mode will probably emit less “blue light” and reduce eye strain. Another advantage is that dark mode requires less energy and spares the battery of your device.

OH! It is now possible to switch between light and dark mode to experience my blog based on your preference 😍

In this blog post we will have a look at how to:

  • Push the settings by using an app (we will use “Intune App Wrapping Tool” to wrap the content before we upload it to MEM
  • Deploy the app to Windows 10 and Windows 11 (it will not change theme in Windows 11, allowing you to push a company wallpaper etc…)
  • Make the app available from Company Portal
  • Make the app install during Autopilot

Prerequisites

  • It is good if you have used “Microsoft Win32 Content Prep Tool” before , but don’t worry – we will cover all the steps

Let’s go!

Preparation

Let’s start off by downloading a few files from Github.

  1. Download the files from Github: W10W11 – Dark Mode at main · NicklasAhlberg/(github.com)
  2. Download “Microsoft Win32 Content Prep Tool” from Github:Microsoft-Win32-Content-Prep-Tool: A tool to wrap Win32 App (github.com)

Content

The “W10W11 – Dark Mode” app is based on “PSAppDeploymentToolKit” – more info can be found here:PSAppDeployToolkit (github.com)

The use of “PSAppDeploymentToolKit” allows us to deploy the needed script as an app during autopilot. The script has been setup to change to dark mode for all users.

Change the script to fit your business

Before we start wrapping the app we should change the script to fit our specific business need. This script will change two register values to enable dark mode. 1 = Lightmode, 0 = Darkmode

  1. Extract “W10W11 – Dark Mode” to C:\Temp\W10W11 – Dark Mode
  2. Open “Deploy-Application.ps1” with your favorite Powershell editor
  3. Edit row: 66 as per your need – this is just for cosmetics
  4. The magic is happing at rows: 135-142, check it out if you are interested in what the script does
  5. Save and close the script

The script will add a new regkey and value to be able to measure successful/unsuccessful installation as well as compliance

Wrap the app

We must wrap the app before we can upload it to MEM

  1. Open “IntuneWinAppUtil.exe” (part of Microsoft Win32 Content Prep Tool)
  2. Please specify the source folder: C:\Temp\W10W11 – Dark Mode
  3. Please specify the setup file: Deploy-Application.exe
  4. Please specify the output folder: C:\Temp\W10W11 – Dark Mode\Intune
  5. Press “Enter
  6. Press “N” and “Enter
  7. We have now wrapped the contents to C:\Temp\W10W11 – Dark Mode\Intune which we will upload to MEM later on

Upload the app to MEM

Now that we have wrapped the app it is time to upload it to MEM

  1. Sign-in to MEM https://endpoint.microsoft.com
  2. Click “Apps“, “All apps” and “Add
  3. App type: “Windows app (Win32)
  4. Select file: C:\Temp\W10W11 – Dark Mode\Intune\Deploy-Application.intunewin
  5. Name: “W10W11 – Set Dark Mode
  6. Description: Add a fitting description as per your need
  7. Publisher: Add a fitting publisher as per you need
  8. App version: 1.0.0.1 this one is important as it will be used to detect the app later on
  9. Information URL (optional): Add URL to this blog post for future reference
  10. Logo (optional): Pick a logo as per your need
  11. Click: “Next
  12. Install command: Deploy-Application.exe -DeploymentType Install
  13. Uninstall Command: Deploy-Application.exe -DeploymentType Uninstall
  14. Click: “Next
  15. Operating system architecture: Pick both 32-bit and 64-bit
  16. Minimum operating system: Windows 10 1909
  17. Click: “Next
  18. Rules format: Manually configure detection rules
  19. Click: “+Add
  20. Rule type: Registry
  21. Key path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Detection\W10W11 – Set Dark Mode
  22. Value name: Version
  23. Detection method: Version comparison
  24. Operator: Greater than or equal to
  25. Value: 1.0.0.1
  26. Click: “OK
  27. Click: “Next” three times
  28. Assignments: Deploy it as required or as available. An available assignment will make the app available from Company Portal
  29. Click: “Next
  30. Click: “Create

So… what have we done?

  1. We have created and uploaded a Win32_app to MEM.
  2. We have assigned the app either as required or as available. Remember, we should assign the app as required if we want it to run during autopilot.
  3. A new registry key and value have been created for us to determine successful/unsuccessful installation.

Now all we need to do is to run the app. Below print screens shows the difference between light/dark mode on Windows 11, the installation is triggered from the Company Portal.

Keep an eye out for coming changes to this post 😉

Leave a Reply

Your email address will not be published. Required fields are marked *