My laptop is connected to two additional HDMI monitors of different models. The PowerShell script reports sizes and positions of the three display screens. The display working areas are reported different when script is executed from a PS console rather than from within PS ISE. There is no difference in computer or monitor setups which ever “PS environment” is used. This results in windows placed on screens are different sizes and positions and mouse movement locations.
Bare-bones code:
Add-Type -AssemblyName System.Windows.Forms
write-host("AllScreens:")
[System.Windows.Forms.Screen]::AllScreens
write-host("Virtual Screen:")
[System.Windows.Forms.SystemInformation]::VirtualScreen
type here
Output using PowerShell by itself:
AllScreens:
BitsPerPixel : 32
Bounds : {X=-1216,Y=0,Width=1216,Height=640}
DeviceName : .DISPLAY1
Primary : False
WorkingArea : {X=-1216,Y=0,Width=1216,Height=610}
BitsPerPixel : 32
Bounds : {X=0,Y=0,Width=1536,Height=864}
DeviceName : .DISPLAY2
Primary : True
WorkingArea : {X=0,Y=0,Width=1536,Height=834}
BitsPerPixel : 32
Bounds : {X=1920,Y=0,Width=1202,Height=676}
DeviceName : .DISPLAY3
Primary : False
WorkingArea : {X=1920,Y=0,Width=1202,Height=646}
Virtual Screen:
Location : {X=-1216,Y=0}
Size : {Width=4338, Height=864}
X : -1216
Y : 0
Width : 4338
Height : 864
Left : -1216
Top : 0
Right : 3122
Bottom : 864
IsEmpty : False
Output executed from ISE:
AllScreens:
BitsPerPixel : 32
Bounds : {X=-1216,Y=0,Width=1216,Height=640}
DeviceName : .DISPLAY1
Primary : False
WorkingArea : {X=-1520,Y=0,Width=1520,Height=763}
BitsPerPixel : 32
Bounds : {X=0,Y=0,Width=1536,Height=864}
DeviceName : .DISPLAY2
Primary : True
WorkingArea : {X=0,Y=0,Width=1920,Height=1042}
BitsPerPixel : 32
Bounds : {X=1920,Y=0,Width=1202,Height=676}
DeviceName : .DISPLAY3
Primary : False
WorkingArea : {X=2400,Y=0,Width=1503,Height=808}
Virtual Screen:
Location : {X=-1520,Y=0}
Size : {Width=5423, Height=1080}
X : -1520
Y : 0
Width : 5423
Height : 1080
Left : -1520
Top : 0
Right : 3903
Bottom : 1080
IsEmpty : False
The working areas are different using the same computer and monitors. It’s interesting that corresponding numbers for the working area very close to a factor of 1.25.
Is there a setting somewhere (registry?) that is wrong causing this discrepancy?
I have numerous patches to correct for these using scaling factors and adding offsets, but I need to find a real fix.
PS4streaming is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1