query monitor EDID


im going to hook up my broken DisplayPort monitor and get the BestViewOption_X setting for it. ill also check that if the model number for that uses how many symbols are in it as well

using this code also works
Code:
$Model = ([System.Text.Encoding]::ASCII.GetString($Monitor.UserFriendlyName)).Replace("$([char]0x0000)","")
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
for the Vivid Gaming option, the reg key is in hexadecimal instead of decimal like color_depth is. how can i convert this code so it uses hexadecimal rather than decimal for the ManufacturerID and ProductID?

Code:
    $bigEndianInt32 = [Convert]::ToInt32(-join $Monitor.ManufacturerName[0..2].ForEach({[Convert]::ToString($_ - 64,2).PadLeft(5,'0')}),2)
    $Manufacturer = (Convert-BigEndianToLittleEndian $bigEndianInt32) -shr 16

    $ProductID = [int]::Parse(-join $Monitor.ProductCodeID[0..3].ForEach{[char]$_}, [System.Globalization.NumberStyles]::HexNumber)
 
Last edited:

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
Code:
    $bigEndianInt32 = [Convert]::ToInt32(-join $Monitor.ManufacturerName[0..2].ForEach({[Convert]::ToString($_ - 64,2).PadLeft(5,'0')}),2)
    $Manufacturer = (Convert-BigEndianToLittleEndian $bigEndianInt32) -shr 16

    $ProductID = [int]::Parse(-join $Monitor.ProductCodeID[0..3].ForEach{[char]$_}, [System.Globalization.NumberStyles]::HexNumber)

    'decimal {0} {1}' -f $Manufacturer, $ProductID
    'hex     {0:x4} {1:x4}' -f $Manufacturer, $ProductID
 

My Computer

System One

  • OS
    Windows 7
i just plugged in my broken DisplayPort monitor and found out that the reg key name remains "BestViewOption", only the value changes. Only HDMI monitors change this reg key name.

when a DisplayPort monitor is hooked up, the value changes. ive been trying to figure out how to query a "notlike" value for DisplayPort configurations. where is the code wrong?

Code:
$SearchPath = "HKLM:\SYSTEM\ControlSet001\Control\Video\$VideoID"

$Which = Read-Host 'DisplayPort = 1 / HDMI = 2 \ Enter Value'
switch ($Which) {
1 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Sort-Object -Unique | Convert-Path | Where-Object { $_.Data -notlike ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00))}}
    $Path}

2 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption_Hdmi* | select PSPath } | Sort-Object -Unique | Convert-Path))
    $Path}
   default {'exiting'}
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
i just plugged in my broken DisplayPort monitor and found out that the reg key name remains "BestViewOption", only the value changes. Only HDMI monitors change this reg key name.

when a DisplayPort monitor is hooked up, the value changes. ive been trying to figure out how to query a "notlike" value for DisplayPort configurations. where is the code wrong?

Code:
$SearchPath = "HKLM:\SYSTEM\ControlSet001\Control\Video\$VideoID"

$Which = Read-Host 'DisplayPort = 1 / HDMI = 2 \ Enter Value'
switch ($Which) {
1 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Sort-Object -Unique | Convert-Path | Where-Object { $_.Data -notlike ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00))}}
    $Path}

2 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption_Hdmi* | select PSPath } | Sort-Object -Unique | Convert-Path))
    $Path}
   default {'exiting'}
[/code
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
Determine which monitor is HDMI or DP.
Code:
<#
  D3DKMDT_VOT_UNINITIALIZED         = -2
  D3DKMDT_VOT_OTHER                 = -1
  D3DKMDT_VOT_HD15                  = 0
  D3DKMDT_VOT_SVIDEO                = 1
  D3DKMDT_VOT_COMPOSITE_VIDEO       = 2
  D3DKMDT_VOT_COMPONENT_VIDEO       = 3
  D3DKMDT_VOT_DVI                   = 4
  D3DKMDT_VOT_HDMI                  = 5
  D3DKMDT_VOT_LVDS                  = 6
  D3DKMDT_VOT_D_JPN                 = 8
  D3DKMDT_VOT_SDI                   = 9
  D3DKMDT_VOT_DISPLAYPORT_EXTERNAL  = 10
  D3DKMDT_VOT_DISPLAYPORT_EMBEDDED  = 11
  D3DKMDT_VOT_UDI_EXTERNAL          = 12
  D3DKMDT_VOT_UDI_EMBEDDED          = 13
  D3DKMDT_VOT_SDTVDONGLE            = 14
  D3DKMDT_VOT_MIRACAST              = 15
  D3DKMDT_VOT_INTERNAL              = 0x80000000
#>

foreach ($Display in Get-WmiObject -Namespace root\WMI WmiMonitorConnectionParams) {
    $Instance = $Display.InstanceName

    switch ($Display.VideoOutputTechnology) {
        5 {
            '{0} HDMI' -f $Instance
        }
        { $_ -in 10,11} {
            '{0} DISPLAYPORT' -f $Instance
        }
        default {
            '{0} DO I CARE?' -f $Instance
        }
    }
}
 

My Computer

System One

  • OS
    Windows 7
i need to find the DisplayPath again, but this time for DisplayPort. when DisplayPort is used, the BestViewOption reg key is a unique value. all the other BestViewOption reg keys are the same value. why wont this string find the unique active BestViewOption?

Code:
2 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Sort-Object -Unique | Convert-Path | Where-Object { $_.Data -notlike ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00))})) {
    $Path

$DisplayPathNumber = Select-String -InputObject $Path -Pattern "(?<=DisplayPath_).*?(?=\\Option)"

$DisplayPathNumber.Matches.Value

$DisplayPathDigit = $DisplayPathNumber.Matches.Value

$DisplayPathDigit
}
}
}

 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
@garlin
dude can you please help me figure this out. for some reason it never returns the right DisplayPath number. i specify the reg key value to "notlike", but it still doesnt find the correct unique reg key for BestViewOption. ive seriously been ttying for the past two days with different values for -notlike and Sort-Object, but it returns the key i tell it to ignore in where-object

Code:
foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Sort-Object -Unique | Convert-Path | Where-Object { $_.BestViewOption -notlike ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00))})) {

$Path
 
Last edited:

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
my fault, heres a pastebin of the $VideoID tree in a reg file


BestViewOption has a unique value when a DisplayPort monitor is plugged in after it chooses a DisplayPath. im trying to have the string ignore the other values so it selects the unique value by using "-notlike"

in this particular instance, DisplayPath_8 was chosen for the DisplayPort monitor.
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
@garlin
while debugging, ive simplified the string to simply look for the active BestViewOption reg key value. this returns an empty output unfortunately. it appears to not be finding the reg key. can you see anything wrong in my code?

Code:
$DisplayPortBinaryActive = ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00))

foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Where-Object { $_.BestViewOption -match $DisplayPortBinaryActive } | Convert-Path))
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
You can't perform a top-level comparison of two arrays, like "$array1 -eq $array2".

PS has the Compare-Object operator:
Code:
# same arrays
$array1 = [byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
$array2 = [byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00)

(Compare-Object $array1 $array2 -SyncWindow 0).Count

# different arrays
$array1 = [byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00)
$array2 = [byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x01) # <- 0x01

(Compare-Object $array1 $array2 -SyncWindow 0).Count

Code:
Where-Object { (Compare-Object $_.BestViewOption $DisplayPortBinaryActive -SyncWindow 0).Count -eq 0 }
 

My Computer

System One

  • OS
    Windows 7
i get an error when adding that string to the line
Code:
Compare-Object : Cannot bind argument to parameter 'ReferenceObject' because it is null.
At C:\Users\shoober420\Downloads\windows11-scripts-main\AMDGPU_VividGaming.ps1:48 char:165
+ ... t PSPath } | Where-Object { (Compare-Object $_.BestViewOption $Displa ...
+                                                 ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Compare-Object], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CompareObje
   ctCommand

EDID_44048_41219_DELL AW2518HF_
EDID_ac10_a103
EDID_ac10_a103
EDID_14937_4166_D32h-J09_
EDID_3a59_1046
EDID_3a59_1046

heres the whole string with the added compare-object cmdlet
Code:
2 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Where-Object { (Compare-Object $_.BestViewOption $DisplayPortBinaryInactive -SyncWindow 0).Count -eq 0 } | Convert-Path)) {
    $Path

i tried to use $_.Name inplace of $_.BestViewOption and i still got the same error. do you know whats causing the error?
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
eureka! i tweaked the string some more and got it working!

Code:
2 {foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name BestViewOption } | Where-Object { (Compare-Object $_.BestViewOption $DisplayPortBinaryInactive -SyncWindow 0).Count -notlike 0 } )) {
    $Path

it now selects the correct DisplayPath the DisplayPort monitor is hooked up too. inreally appreciate you and helping me learn powershell. this turned out to be a bigger project than i imagined, but it was worth it. what a cool piece of code. thanks brother


 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420
i should also mention that these scripts dont support multi-monitor setups. i will try and add that later, but im going to take a break
 

My Computer

System One

  • OS
    Windows 11 27783
    Computer type
    PC/Desktop
    CPU
    Intel i7 7700 @4.0ghz
    Memory
    64gb DDR4
    Graphics Card(s)
    Radeon RX 5500 XT
    Other Info
    https://www.github.com/shoober420

Latest Support Threads

Back
Top Bottom