Install-Module DisplayConfig
Add-Type -AssemblyName System.Windows.Forms
function Get-CommonResolution {
$screens = [System.Windows.Forms.Screen]::AllScreens
$resolutions = @()
foreach ($screen in $screens) {
$width = $screen.Bounds.Width
$height = $screen.Bounds.Height
$resolutions += "$width x $height"
}
# Find the minimum resolution (common denominator)
$minWidth = ($screens | Measure-Object -Property Bounds.Width -Minimum).Minimum
$minHeight = ($screens | Measure-Object -Property Bounds.Height -Minimum).Minimum
return @{ Width = $minWidth; Height = $minHeight }
}
function Set-Resolution {
param (
[int]$Width,
[int]$Height
)
$mode = "$Width,$Height,32,60"
$command = "DisplaySwitch.exe /extend"
Start-Process -FilePath "cmd.exe" -ArgumentList "/c $command" -Wait
# Use NirCmd or MultiMonitorTool for actual resolution change
# Example with NirCmd:
# nircmd.exe setdisplay 1 $Width $Height 32
}
# Main
$commonRes = Get-CommonResolution
Set-Resolution -Width $commonRes.Width -Height $commonRes.Height"
How to set common resolution for all connected display through PowerShell
Sreekanth N Kartha
60
Reputation points
Require a PowerShell code that sets all the displays connected including the primary display to a maximum common resolution.
Windows for business | Windows Server | User experience | PowerShell
1 answer
Sort by: Most helpful
-
gastone canali 241 Reputation points Volunteer Moderator
2025-08-28T12:48:20.2333333+00:00