Rearrange displays using powershell

Viewed 1047

I have a machine with two screens. For some reason my windows doesn't keep the configuration when I rearrange the display on Windows display settings.

Actually my displays are listed as

!-------!!-------!
!       !!       !
!   2   !!   1   !
!       !!       !
!-------!!-------!

and I would like to have then as

!-------!!-------!
!       !!       !
!   1   !!   2   !
!       !!       !
!-------!!-------!

This powershell code return to me the display properties:

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY4
Primary      : True
WorkingArea  : {X=0,Y=0,Width=1920,Height=1040}

BitsPerPixel : 32
Bounds       : {X=-1920,Y=0,Width=1920,Height=1080}
DeviceName   : \\.\DISPLAY5
Primary      : False
WorkingArea  : {X=-1920,Y=0,Width=1920,Height=1040}

Wondering if there is any way, in powershell, to set the WorkingArea and Bounds properties for the seconds display.

I need that to go from

Bounds       : {X=-1920,Y=0,Width=1920,Height=1080}
WorkingArea  : {X=-1920,Y=0,Width=1920,Height=1040}

To

Bounds       : {X=1920,Y=0,Width=1920,Height=1080}
WorkingArea  : {X=1920,Y=0,Width=1920,Height=1040}

If I have a code that could this I can run the code automatically when I login into the PC and I I will automate this daily and tedious task of rearrange my displays.

Any suggestion?

0 Answers
Related