FILE: C:\Windows\diagnostics\system\Video\RC_viddrv_displaytopology.ps1
--
# Copyright © 2018, Microsoft Corporation. All rights reserved.
#*=================================================================================
# Parameters
#*=================================================================================
#*=================================================================================
# Load Utilities
#*=================================================================================
. ./utils_SetupEnv.ps1
#*=================================================================================
# Initialize
#*=================================================================================
Import-LocalizedData -BindingVariable Strings_Main -FileName CL_LocalizationData
#*=================================================================================
# Run detection logic
#*=================================================================================
Write-DiagProgress -Activity $Strings_Main.ID_Check_DisplayTopology
$isLowRes = $false
$string = ""
$stDisplayTopologyMapXML = New-Object System.Collections.ArrayList
$stDisplayTopologyMap = [VideoDiagnostic.VideoConfigManager]::IsDiagnosticDone()
# create a string to display to the user
For ($i = 0; $i -lt $stDisplayTopologyMap.uiNumAdapters; $i++){
$string += "Adapter:" + $i + " Device ID " + $($stDisplayTopologyMap.aAdapterInfo[$i].uiDeviceId) + " `n"
#convert char array to string to remove the null operator
$strDescription = New-Object System.String($stDisplayTopologyMap.aAdapterInfo[$i].chDescription,0,$stDisplayTopologyMap.aAdapterInfo[$i].chDescription.Length)
$string += " Adapter Name: " + $strDescription.Trim([char]0) + " `n"
$stDisplayTopologyMapXML.Add((New-Object PSObject -Property @{
'Adapter'= $i
'Device ID'= $stDisplayTopologyMap.aAdapterInfo[$i].uiDeviceId
'Adapter Name'= $strDescription.Trim([char]0)
}))
For ($j = 0; $j -lt $stDisplayTopologyMap.aAdapterInfo[$i].uiNumOutputs; $j++){
$string += "Output:" + $j + " Monitors Attached " + $($stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiNumMonitorsAttached+1) + " `n"
$object = New-Object –TypeName PSObject
$object | Add-Member –MemberType NoteProperty –Name "Output" –Value $j
$numMonitors = $stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiNumMonitorsAttached+1
$object | Add-Member –MemberType NoteProperty –Name "Monitors Attached" –Value $numMonitors
$string += " Primary " + $($stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiIsPrimary) + " `n"
$object | Add-Member –MemberType NoteProperty –Name "Primary" –Value $stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiIsPrimary
$string += " ResolutionX " + $($stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiResolutionX) + " `n"
$object | Add-Member –MemberType NoteProperty –Name "ResolutionX" –Value $stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiResolutionX
if ($stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiResolutionX -lt 1280)
{
$isLowRes = $true
}
$string += " ResolutionY " + $($stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiResolutionY) + " `n"
$object | Add-Member –MemberType NoteProperty –Name "ResolutionY" –Value $stDisplayTopologyMap.aAdapterInfo[$i].aOutputInfo[$j].uiResolutionY
$stDisplayTopologyMapXML.Add($object)
}
}
# send to detailed information page
$stDisplayTopologyMapXML | convertto-xml | update-diagreport -id "Display Topology" -name "Display Topology" -verbosity informational
if ($isLowRes -eq $true)
{
update-diagrootcause -id "RC_LowResolution" -detected $true -Parameter @{'DisplayInfo' = $string}
}
--