Hello Linus,
Thank you for your question and for reaching out with your question today.
I have used the following code in the past to identify the monitors within my multi monitor setup:
function GetMonitorSerial () {
$Monitor =(Get-WmiObject -NameSpace root\wmi -Class wmiMonitorID -EA 0 | ForEach-Object {
$([System.Text.Encoding]::Ascii.GetString($($_.SerialNumberID)))
})
$MON0 = $Monitor[0]
$MON1 = $Monitor[1]
$MON2 = $Monitor[2]
$MON3 = $Monitor[3]
Write-Host "Monitor #0: " $MON0
Write-Host "Monitor #1: " $MON1
Write-Host "Monitor #2: " $MON2
Write-Host "Monitor #3: " $MON3
}
GetMonitorSerial
If the reply was helpful, please don’t forget to upvote or accept as answer.
Best regards.
How to identify actual used display with Powershell

Niesel, Linus
0
Reputation points
Hi,
I have a PowerShell script with a GUI in a multi monitor environment. When moving the GUI Window from one screen to another, is there any possibility to check on which screen the window is (in order to reset the resolution of the GUI Window according to screen resolution/size). I have identified all screens with their resolution, but I cannot identify on which screen the window is programmatically...
Cheers, Linus
1 answer
Sort by: Most helpful
-
Limitless Technology 25,816 Reputation points
2023-05-24T10:44:03.0166667+00:00