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

If you rather change it for all users, for example during deployment, 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 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 9 votes
Article Rating
Subscribe
Notify of
guest
6 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jimmy Meek
Jimmy Meek
6 months 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.

Frederic
Frederic
6 months 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
6 months 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
7 months ago

What else does the mask set?

Matt
Matt
1 year ago

Thanks Johan, excellent like always.


>