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
- 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 start off by downloading a few files from Github.
- Download the files from Github: W10W11 – Dark Mode at main · NicklasAhlberg/(github.com)
- Download “Microsoft Win32 Content Prep Tool” from Github:Microsoft-Win32-Content-Prep-Tool: A tool to wrap Win32 App (github.com)
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
- Extract “W10W11 – Dark Mode” to C:\Temp\W10W11 – Dark Mode
- Open “Deploy-Application.ps1” with your favorite Powershell editor
- Edit row: 66 as per your need – this is just for cosmetics
- The magic is happing at rows: 135-142, check it out if you are interested in what the script does
- 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
- Open “IntuneWinAppUtil.exe” (part of Microsoft Win32 Content Prep Tool)
- Please specify the source folder: C:\Temp\W10W11 – Dark Mode
- Please specify the setup file: Deploy-Application.exe
- Please specify the output folder: C:\Temp\W10W11 – Dark Mode\Intune
- Press “Enter“
- Press “N” and “Enter“
- 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
- Sign-in to MEM https://endpoint.microsoft.com
- Click “Apps“, “All apps” and “Add“
- App type: “Windows app (Win32)“
- Select file: C:\Temp\W10W11 – Dark Mode\Intune\Deploy-Application.intunewin
- Name: “W10W11 – Set Dark Mode“
- Description: Add a fitting description as per your need
- Publisher: Add a fitting publisher as per you need
- App version: 22.214.171.124 this one is important as it will be used to detect the app later on
- Information URL (optional): Add URL to this blog post for future reference
- Logo (optional): Pick a logo as per your need
- Click: “Next“
- Install command: Deploy-Application.exe -DeploymentType Install
- Uninstall Command: Deploy-Application.exe -DeploymentType Uninstall
- Click: “Next“
- Operating system architecture: Pick both 32-bit and 64-bit
- Minimum operating system: Windows 10 1909
- Click: “Next“
- Rules format: Manually configure detection rules
- Click: “+Add“
- Rule type: Registry
- Key path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Detection\W10W11 – Set Dark Mode
- Value name: Version
- Detection method: Version comparison
- Operator: Greater than or equal to
- Value: 126.96.36.199
- Click: “OK“
- Click: “Next” three times
- Assignments: Deploy it as required or as available. An available assignment will make the app available from Company Portal
- Click: “Next“
- Click: “Create“
So… what have we done?
- We have created and uploaded a Win32_app to MEM.
- 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.
- 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 😉
Hello Nicklas, thx for this post. I was looking for a solution.
It seems to work, but users do get an errorcode (even though the dark theme is set.
I get this errorcode: Error code: 0x87D1041C The application was not detected after installation completed successfully.
I did the steps again to see if i made a mistake, but the error keeps popping up. Do you have an idea where the error comes from?
Thx in advance. I am pushing this to every teacher in my school.
Please confirm that the regkey: “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Detection\W10W11 – Set dark theme” and regvalue: “version” with value: “188.8.131.52” have been created.