Hello Kartha,
Display scaling is a user-specific setting, so to apply it system-wide, the script needs to modify the registry for all current and future users on the machine. It will iterate through all currently loaded user profiles to apply the setting immediately for logged-in users and will also modify the default user profile, ensuring any new user who logs onto the machine will inherit this setting.
You can prefer to set 100% Scaling with PowerShell Script:
# This script sets the display DPI scaling to 100% (96 DPI) for all users.
# It must be run with elevated privileges (as Administrator or SYSTEM).
function Set-DpiScaling {
param(
[string]$RegistryPath,
[int]$DpiValue = 96 # 96 DPI corresponds to 100% scaling
)
try {
$desktopPath = Join-Path -Path $RegistryPath -ChildPath "Control Panel\Desktop"
$metricsPath = Join-Path -Path $desktopPath -ChildPath "WindowMetrics"
# Ensure the registry paths exist before trying to set properties
if (Test-Path -Path $desktopPath) {
# Set legacy scaling values for compatibility
Set-ItemProperty -Path $desktopPath -Name "Win8DpiScaling" -Value 1 -Type DWord -Force -ErrorAction Stop
Set-ItemProperty -Path $desktopPath -Name "LogPixels" -Value $DpiValue -Type DWord -Force -ErrorAction Stop
}
if (Test-Path -Path $metricsPath) {
# Set modern scaling value
Set-ItemProperty -Path $metricsPath -Name "AppliedDPI" -Value $DpiValue -Type DWord -Force -ErrorAction Stop
}
Write-Host "Successfully applied DPI settings to path: $RegistryPath"
}
catch {
Write-Warning "Could not apply DPI settings to '$RegistryPath'. Error: $($_.Exception.Message)"
}
}
# --- Step 1: Apply to all currently logged-in users ---
Write-Host "Applying settings for currently loaded user profiles..."
$loadedSids = Get-ChildItem "Registry::HKEY_USERS" | Where-Object { $_.Name -like "*S-1-5-21-*" } | ForEach-Object { $_.PSChildName }
foreach ($sid in $loadedSids) {
$userHivePath = "Registry::HKEY_USERS\$sid"
Set-DpiScaling -RegistryPath $userHivePath
}
# --- Step 2: Apply to the Default User Profile for all future users ---
Write-Host "Applying settings to the Default User Profile..."
try {
# Load the default user hive from its file location
reg load "HKU\DefaultUser" "C:\Users\Default\NTUSER.DAT" | Out-Null
Set-DpiScaling -RegistryPath "Registry::HKEY_USERS\DefaultUser"
}
catch {
Write-Warning "Failed to load or modify the Default User registry hive. Error: $($_.Exception.Message)"
}
finally {
# CRITICAL: Always unload the hive, regardless of success or failure
reg unload "HKU\DefaultUser" | Out-Null
}
Write-Host "Script execution complete. A reboot or user logoff/logon is required for the changes to take effect."
How to Use This Script:
- Save the Script: Copy the code above and save it to a file named
Set-Scaling-100.ps1. - Execution in System Context: You can deploy and run this script using management tools like Microsoft Intune or System Center Configuration Manager (SCCM). For manual testing, you can use the psexec tool from Sysinternals to run it as the SYSTEM account:
-
psexec -s -i powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\your\script\Set-Scaling-100.ps1"
-
If you find this information helpful and it solves your problem, please feel free to hit "accept answer." It was a pleasure assisting you! 😊