File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments