Virtual Display Manager includes the VDMXPS PowerShell module for automating configurations, monitor snapshots, Windows Virtual Desktops, VDM state, and runtime events. VDMXPS targets .NET Framework 4.8 and supports Windows PowerShell 5.1 and PowerShell 7 on Windows.
Import the installed module:
Import-Module "C:\Program Files (x86)\VDM\System32\UI\VDMXPS.dll"
List the available commands:
Get-Command -Module VDMXPS
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-VdmConfigs 4.0.0.462… VDMXPS
Cmdlet Get-VdmMonitorSnapshots 4.0.0.462… VDMXPS
Cmdlet Get-VdmVirtualDesktops 4.0.0.462… VDMXPS
Cmdlet Register-VdmEvent 4.0.0.462… VDMXPS
Cmdlet Set-VdmActiveConfig 4.0.0.462… VDMXPS
Cmdlet Set-VdmActiveMonitorSnapshot 4.0.0.462… VDMXPS
Cmdlet Set-VdmActiveVirtualDesktop 4.0.0.462… VDMXPS
Cmdlet Set-VdmDefaultConfig 4.0.0.462… VDMXPS
Cmdlet Set-VdmOff 4.0.0.462… VDMXPS
Cmdlet Set-VdmOn 4.0.0.462… VDMXPS
Cmdlet Stop-Vdm 4.0.0.462… VDMXPS
Cmdlet Unregister-VdmEvent 4.0.0.462… VDMXPS
VDMXPS communicates with the authoritative VDMX runtime. If VDMX is not running, ordinary query, configuration, and event-subscription commands start it automatically before performing the requested operation.
There is therefore no separate Start-Vdm cmdlet. Stop-Vdm gracefully stops an existing VDMX runtime and is a successful no-op if VDMX is not running.
List the available VDM configurations:
Get-VdmConfigs
ConfigName ID IsActive IsDefault
---------- -- -------- ---------
1/4|2|3 f5cf7a7a9e1eaf46bcafebbcd4b70990 True True
1|2/3+1 1b8f4f18d20b5014ec86a40dafed11cf False False
2x1 0d0bd32f934762ea407d5766f5942ed9 False False
2x2 edccbba329cc090ccff77ab0abb6059d False False
3+1 17d2a5f52331718e00c2b5e2e8a205bb False False
Activate a configuration by name:
Set-VdmActiveConfig -Name "1|2/3+1"
You can also activate it by ID:
Set-VdmActiveConfig -ID "1b8f4f18d20b5014ec86a40dafed11cf"
List the available Windows Virtual Desktops:
Get-VdmVirtualDesktops
Name IsActive Index Guid
---- -------- ----- ----
Desktop 1 True 0 dd158d79-8de4-44f4-a527-4425c1086484
Desktop 2 False 1 339ba945-4d72-423d-8d65-85169a7b17c9
Custom Desktop False 2 f0d6f737-9bb1-4ae8-8617-ac1725d21075
Switch to a Virtual Desktop by sequential index, name or ID:
Set-VdmActiveVirtualDesktop -Index "1"
Set-VdmActiveVirtualDesktop -Name "Desktop 2"
Set-VdmActiveVirtualDesktop -ID "339ba945-4d72-423d-8d65-85169a7b17c9"
Monitor snapshots preserve and restore Windows display topology, including monitor resolution, placement, and mirroring.
Get-VdmMonitorSnapshots
Name Index
---- -----
1+1080p Mirror 0
1+2+3 1
1+2+3 Alternative 2
2 3
2 monitors - low res 4
2+3 5
2+3 shifted 6
5k+8k 7
Apply a snapshot by name or by index:
Set-VdmActiveMonitorSnapshot -Name "1+2+3"
Set-VdmActiveMonitorSnapshot -Index "1"
VDMXPS can subscribe to completed runtime transitions and publish them through PowerShell’s event system.
/* Supportet events types:
- ConfigurationActivated
- VirtualDesktopChanged
- VDMStateChanged */
/* Envent subscription */
$subscription = Register-VdmEvent ConfigurationActivated
$event = Wait-Event -SourceIdentifier "VDMX.Automation.ConfigurationActivated"
$event.SourceArgs[0] | Format-List *
/* Remove the received event from the PowerShell event queue and end the subscription: */
Remove-Event -EventIdentifier $event.EventIdentifier
$subscription | Unregister-VdmEvent
/* Subscribe to a VDM state change */
$subscription = Register-VdmEvent VDMStateChanged
Set-VdmOff
$event = Wait-Event `
-SourceIdentifier "VDMX.Automation.VDMStateChanged" `
-Timeout 15
$event.SourceArgs[0] | Format-List *
Remove-Event -EventIdentifier $event.EventIdentifier
$subscription | Unregister-VdmEvent
/* Subscribe to all currently supported events */
$subscription = Register-VdmEvent "*"
/* Each event still uses its specific source identifier:
- VDMX.Automation.ConfigurationActivated
- VDMX.Automation.VirtualDesktopChanged
- VDMX.Automation.VDMStateChanged */
/* Enable monitor split */
Set-VdmOn
/* Disable monitor split */
Set-VdmOff
/* To stop VDM itself */
Stop-Vdm