Skip to content

Commit d437ebc

Browse files
Merge pull request #391 from VirtualDrivers/PS-Get_Disp_Num-update
Added a pause for VDC execution
2 parents 0a095d4 + 5aa453b commit d437ebc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Community Scripts/get_disp_num.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
Get-Monitor | Where-Object { $_.InstanceName -like '*MTT1337*' } | Sort-Object { [int] (($_.InstanceName -match 'UID(\d+)') -and $Matches[1]) } | Select-Object -First 1 -ExpandProperty LogicalDisplay | select-object Devicename
1+
# One-liner to get the logicalname of the first VDD
2+
# You can alter the script -First 3, would make the third in the list,
3+
# or -Last 2 would give second from last.
4+
5+
$dispnum = (Get-Monitor | Where-Object { $_.InstanceName -like '*MTT1337*' } | Sort-Object { [int] (($_.InstanceName -match 'UID(\d+)') -and $Matches[1]) } | Select-Object -First 1).LogicalDisplay.DeviceName
6+
7+
# Echo the result to console
8+
Write-Host $dispnum
9+
10+
# Pause the console from closeing when executed from VDC
11+
Write-Host "Press any key to continue ..."
12+
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null

0 commit comments

Comments
 (0)