r/PowerShell • u/Dazzling-Neat-6278 • May 14 '26
Question Reliably switching primary display at boot via script — looking for the right approach
Setup: Windows 11 | RTX 5080 | Three displays: physical monitor (ID: AUS274D), a case-mounted display (ID: RTK409A), and a Virtual Display Driver (ID: MTT1337)
Goal: A PowerShell script triggered at logon via Task Scheduler that:
- Detects whether the physical monitor is connected at boot
- If yes → set it as primary, virtual display disabled
- If no → set virtual display as primary, all physical displays disabled
Using the monitor cable as a boot-time toggle — no menus, no manual steps.
Current approach: Detecting monitor presence via MultiMonitorTool's CSV export (Short Monitor ID), then switching primary with /SetPrimary and /enable / /disable.
Questions:
- Is Short Monitor ID detection via MultiMonitorTool reliable before GPU drivers fully initialize at boot?
- Is there a more reliable detection method — WMI, EDID query, registry?
- Any known timing issues with display enumeration on NVIDIA systems at logon?
Open to alternative tools if MultiMonitorTool isn't the right fit here.
3
u/purplemonkeymad May 14 '26
I don't know about the issue, but in the past we have used dummy hdmi connectors that just present as a 1080p monitor to solve any virtual monitor issues. That way it's always a "real" display to windows.
1
u/MartinGC94 May 14 '26
If you are physically changing the setup then Windows should recognize that and restore whatever configuration that physical configuration had the last time it was used so you shouldn't even have to script this in the first place.
I don't know anything about MultiMonitorTool so I can't comment on that, but I have made my own PowerShell module that should be able to handle this:
DisplayConfig. You can use$DisplayInfo = Get-DisplayInfoto get info about your current setup (The positions of each individual display, EDID info like the monitor serial number and whether or not they are active or primary).When you have that data you just need to define your logic and run
Set-DisplayPrimaryaccordingly. Simple demo script:1
u/BlackV May 14 '26
You can't run a script before windows is fully booted, PowerShell is not there, anything you're running is post boot
So a scheduled task is your best bet
Do you have working code already?
3
u/arslearsle May 14 '26
Check out
Get-CimInstance win32_pnpentity | where{$_.pnpclass -eq 'monitor'}
Good luck!