Disable DWM: using Server Core UI
Sept 14, 2020 12:42:39 GMT -8
Post by rma92 on Sept 14, 2020 12:42:39 GMT -8
On Windows Server Core installations, a command line version of CredUI is available if you use a GUI application to connect to a network share, or any other time a credential dialog would show (e.g. MSTSC). I wanted to see if I could get a GUI Server installation to behave the same way. This should also work on Windows 10, but I haven't tested this extensively yet.
What this entails is exporting HKLM\SOFTWARE\Microsoft\WindowsRuntime from Server Core, and importing it on a Server with a GUI installation.
Note: As with many tweaks on this site, you may break your system. YMMV. I did this on Server 2019 (so 1809), and it went relatively well, but I haven't tested extensively. I wanted to share this, as not having a working CredUI/UAC UI is a major pain point for me using any of this day to day, and I'm sure it is for others as well.
Limitations:
- Explorer Shell does not work. Explorer as a file browser does work, but unless you use the legacy File Browser tweak, there is a broken area of the screen, just like any other time DWM is disabled. You should make sure HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell is not set to explorer.exe, as this will allow you to use the file browser standalone.
- Internet Explorer does not work (although this is not different than any other time when DWM is disabled).
- PC Settings (Xaml application) does not work. Any other Xaml things won't work of course, as DWM is not running.
- Logon is sluggish. I think this is related to userinit, but am not certain why.
Requirements:
- Windows Server 2019, or Windows Hyper-V Server 2019 (to make a server core install)
- Windows Server 2019 in a GUI installation, although it should work on Windows 10 also.
- Some method of booting WinPE on the machine where you will be performing the swap. You must use WinPE to perform the swap, otherwise permissions and locks will get in the way. A Windows Setup ISO will do for this, as you can hit Shift+F10 to get to cmd.
Part 0 - recommended preparation on the GUI system:
- Set the shell to cmd.exe. Change HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Shell to cmd.exe.
Part 1 - export WindowsRuntime from a core system:
- On a Server Core or Hyper-V server machine, open registry editor.
- Navigate to HKLM\Software\Microsoft\WindowsRuntime
- Export this key and it's subkeys to a .reg file. Mine was about 300-400KB. (It's around 3MB on a GUI system).
- Copy the .reg file to the GUI system.
Part 2 - import the new registry on the GUI system
- Boot into WinPE or Windows Setup. If you booted into Setup, hit Shift+F10 to get a command prompt.
- Run regedit.
- Click on HKEY_LOCAL_MACHINE.
- File > Load Hive...
- Open C:\Windows\System32\config\SOFTWARE (make sure you get it from the drive with the windows installation, not the WinPE temp drive. It may be a different drive letter depending on your system configuration).
- I named the loaded hive "ax".
- Run notepad.
- Open the .reg file you moved over in notepad.
- Edit > Find and Replace the following (no quotes)
with: "[HKEY_LOCAL_MACHINE\ax\"
- Save the .reg file.
- In Regedit, it's a good idea to export the existing WindowsRuntime just in case. Go to HKLM\ax\Microsoft\WindowsRuntime, File>Export... and save this somewhere else.
- Rename the WindowsRuntime key to WindowsRuntime-Gui (you can hit F2 while it's selected, or right click it).
- File>Import..., and choose the .reg file you edited earlier.
- It's good practice to unload the hive manually, select HKLM\ax, choose File>Unload Hive.
- You can close registry editor now.
- In CMD, go to C:\Windows\System32 (on the drive of the windows install, it may not be C: in your configuration)
- Rename "dwm.exe" > "dwm.disabled.exe"
- Copy "rundll32.exe" > "dwm.exe"
- Rename "Windows.UI.Logon.dll" "Windows.UI.Logon.disabled.dll"
- At this point you should be able to reboot and have a system that works, console logon, no DWM, and user permission prompts should work in a predictable way.
Reverting this:
- Boot into WinPE, load the system hive, Rename the WindowsRuntime (from core) to WindowsRuntime-core, and WindowsRuntime-Gui to WindowsRuntime.
- Revert the file naming done above.
I'll be testing this further, but this basically safely removes Xaml and allows other system functions to work as expected.
It also enables an interesting scenario of having all of the GUI tools available on a Windows Server installation, but not wasting the resources of running DWM.
rma92