Public/Display/Get-CimVideoControllerResolution.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<#
.SYNOPSIS
Returns the CIM_VideoControllerResolution Properties for the Primary Screen
 
.DESCRIPTION
Returns the CIM_VideoControllerResolution Properties for the Primary Screen
 
.LINK
https://osd.osdeploy.com/module/functions/cim
 
.NOTES
21.2.1 Initial Release
#>

function Get-CimVideoControllerResolution {
    [CmdletBinding()]
    param (

        #Returns Interlaced resolutions
        [switch]$Interlaced=$false
    )

    $GetMyVideoControllerResolution = (Get-CimInstance -Class CIM_VideoControllerResolution | Select-Object -Property * | `
    Select-Object SettingID, Caption, HorizontalResolution, VerticalResolution, NumberOfColors, RefreshRate, ScanMode | `
    Sort-Object HorizontalResolution, VerticalResolution -Descending)

    #HorizontalResolution -ge 800
    $GetMyVideoControllerResolution = $GetMyVideoControllerResolution | Where-Object {$_.HorizontalResolution -ge 800}

    if ($Interlaced -eq $true) {
        #Interlaced
        $GetMyVideoControllerResolution = $GetMyVideoControllerResolution | Where-Object {$_.ScanMode -eq 5}
    }
    else {
        $Progressive
        $GetMyVideoControllerResolution = $GetMyVideoControllerResolution | Where-Object {$_.ScanMode -eq 4}
    }

    Return $GetMyVideoControllerResolution
}