Fixing Borderless Windows in Windows Server 2019 and Windows Server 2022

Starting with Windows Server 2019 someone at Microsoft apparently thought it was a great idea to make the various application-windows borderless, making it really hard to see the windows. Below is an example of two File Explorer windows overlapping, the arrow pointing to the top border of the window in front.

Borderless Windows

The Fix via PowerShell – Current User

Fixing the issue is quite easy, simply add a registry key the restores the behavior back to how it was in Windows Server 2016. Here is a PowerShell snippet that does it for you:

$RegistryKey = "HKCU:Control Panel\Desktop"
$Name = "UserPreferencesMask"
$Value = ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00))
$Type = "Binary"
New-ItemProperty -Path $RegistryKey -Name $Name -Value $Value -PropertyType $Type -Force

Note: You need to log out and login for the setting to take effect.

Windows with Borders

The Fix via PowerShell – Default User for Offline Injection in WinPE

If you rather change it for all users, for example during the WinPE phase when imaging a device, you can load the default user registry and set the value there. Here is an example:

# Load the offline registry hive from the OS volume
$HivePath = "C:\Users\Default\NTUSER.DAT"
New-PSDrive -PSProvider Registry -Root HKEY_USERS -Name HKU
reg load "HKU\Tmp" $HivePath 
Start-Sleep -Seconds 5

# Updating default registry hive to show Windows Borders
$RegistryKey = "HKU:Tmp\Control Panel\Desktop"
$Name = "UserPreferencesMask"
$Value = ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00))
$Type = "Binary"
New-ItemProperty -Path $RegistryKey -Name $Name -Value $Value -PropertyType $Type -Force

# Cleanup (to prevent access denied issue unloading the registry hive)
Get-Variable Registry* | Remove-Variable
[gc]::collect()
Start-Sleep -Seconds 5

# Unload the registry hive
reg unload "HKU\Tmp" 

The Fix via PowerShell – Default User in full Windows

If you rather change it for all users, when a task sequence is in full Windows (no longer WinPE), you can also load the default user registry and set the value there. Here is an example (Thanks Rakesh for the script/comment):

# Load the online registry hive from the Windows volume
$HivePath = "C:\Users\Default\NTUSER.DAT"
New-PSDrive -PSProvider Registry -Root HKEY_USERS -Name HKU
reg load "HKU\Default" $HivePath 
Start-Sleep -Seconds 5

# Updating default registry hive to show Windows Borders
$RegistryKey = "HKU:Default\Control Panel\Desktop"
$Name = "UserPreferencesMask"
$Value = ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00))
$Type = "Binary"
New-ItemProperty -Path $RegistryKey -Name $Name -Value $Value -PropertyType $Type -Force

# Cleanup (to prevent access denied issues when unloading the registry hive)
Get-Variable Registry* | Remove-Variable
[gc]::collect()
Start-Sleep -Seconds 5

# Unload the registry hive
reg unload "HKU\Default"

The Fix via Group Policy Preference

If using legacy Active Directory, you can also create a Group Policy Preference that sets the value. Create a new Group Policy and navigate to User Configuration / references / Windows Settings / Registry. Then add a Registry Item with the following settings:

  • Action: Update
  • Hive: HKEY_CURRENT_USER
  • Key Path: Control Panel\Desktop
  • Value name: UserPreferencesMask
  • Value type: REG_BINARY
  • Value data: 9032078010000000
Creating a Group Policy Preference
About the author

Johan Arwidmark

5 11 votes
Article Rating
Subscribe
Notify of
guest
10 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
mark
mark
1 month ago

This did not work for me. Here is the correction for server 2019 and 2022

  1. Registry Item Addition:
  • Action: Update
  • Hive: HKEY_CURRENT_USER
  • Key Path: SOFTWARE\Microsoft\Windows\DWM
  • Value name: ColorPrevalence
  • Value type: REG_DWORD
  • Select "Decimal"
  • Value data: 1
  • Click "Apply", then "OK".

the correction for server 2019 or 2022

Jimmy Meek
Jimmy Meek
1 year ago

I used the Group Policy Preference method and it works great. As soon as users logged out and back in again, this was set. This was especially handy since we have multiple Remote Desktop servers and it only had to be set once. Much appreciated Johan.

Rakesh kondabattini
Rakesh kondabattini
9 months ago
Reply to  Jimmy Meek

Add this script for default users to work as expected we have changed tmp instead of default # Load the offline registry hive from the OS volume $HivePath = "C:\Users\Default\NTUSER.DAT" New-PSDrive -PSProvider Registry -Root HKEY_USERS -Name HKU reg load "HKU\Default" $HivePath  Start-Sleep -Seconds 5 # Updating default registry hive to show Windows Borders $RegistryKey = "HKU:Default\Control Panel\Desktop" $Name = "UserPreferencesMask" $Value = ([byte[]](0x90,0x32,0x07,0x80,0x10,0x00,0x00,0x00)) $Type = "Binary" New-ItemProperty -Path $RegistryKey -Name $Name -Value $Value -PropertyType $Type -Force # Cleanup (to prevent access denied issues when unloading the registry hive) Get-Variable Registry* | Remove-Variable [gc]::collect() Start-Sleep -Seconds 5 # Unload the registry… Read more »

Frederic
Frederic
1 year ago

Hello Johan, I did some tests, I found that the active setup "Windows Desktop Update" changes the values of UserPreferencesMask which is in the default user on the new user, if i delete the active setup "Windows Desktop Update" the parameter that is in the default user is indeed applied to the new user, but I don't know the impact that deleting this key can have!

Frederic
Frederic
1 year ago

Hello Johan, I tested your procedure by adding the registry key in the default user on Win2019 and Win2022, but nothing is applied to new users, should something else be changed?

John
John
1 year ago

What else does the mask set?

Matt
Matt
2 years ago

Thanks Johan, excellent like always.


>