Thanks a lot, this a great workaround. It solved my problem. I only added an exception for Windows 7 because it always reports the correct resolution and multiplying it with the scaling factor would falsify the resolution.
Yes, the computers I used for testing have been restarted multiple times, the change of dpi was applied correctly.
I can easily reproduce this behaviour. I just save
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$Size = [System.Windows.Forms.SystemInformation]::PrimaryMonitorSize
$Size.Width
$Size.Height
Read-Host -Prompt "Press Enter to exit"
into a file like test.ps1, right click on it, run with PowerShell => wrong resolution on Windows 10 and Server 2012 R2, correct resolution on Windows 7.
When execute this code inside the PowerShell ISE it works under all circumstances. Did you try both, PowerShell.exe and PowerShell_ISE.exe?