Scripts/Get-PCVideoController.ps1

Function Get-PCVideoController {

    <#
 
    .SYNOPSIS
    Get video card information/configuration
 
    .DESCRIPTION
    Get video card information/configuration
 
    .PARAMETER ComputerName
    Name of the target computer
 
    .EXAMPLE
    Get-PCVideoController -ComputerName LabPC2024
 
    .NOTES
    N/A
 
    .LINK
    N/A
 
    #>


    [CmdletBinding ()]

    Param (

        [Parameter (Mandatory = $True,
                    ValueFromPipeline = $True,
                    ValueFromPipelineByPropertyName = $True,
                    HelpMessage = 'Enter computer name'
                   )
        ]

        [String[]]$ComputerName

    )

    BEGIN {

        $VideoAvailability = @{

            '1' = 'Other'
            '2' = 'Unknown'
            '3' = 'Running/Full power'
            '4' = 'Warning'
            '5' = 'In test'
            '6' = 'Not applicable'
            '7' = 'Power off'
            '8' = 'Off line'
            '9' = 'Off duty'
            '10' = 'Degraded'
            '11' = 'Not installed'
            '12' = 'Install error'
            '13' = 'Power save/Unknown'
            '14' = 'Power save/Low power mode'
            '15' = 'Power save/Standby'
            '16' = 'Power cycle'
            '17' = 'Power save/Warning'
            '18' = 'Paused'
            '19' = 'Not ready'
            '20' = 'Not configured'
            '21' = 'Quiet'

        }

        $VideoArchitecture = @{

            '1' = 'Other'
            '2' = 'Unknown'
            '3' = 'CGA'
            '4' = 'EGA'
            '5' = 'VGA'
            '6' = 'SVGA'
            '7' = 'MDA'
            '8' = 'HGC'
            '9' = 'MCGA'
            '10' = '8514A'
            '11' = 'XGA'
            '12' = 'Linear frame buffer'
            '160' = 'PC-98'

        }

        $VideoScanMode = @{

            '1' = 'Other'
            '2' = 'Unknown'
            '3' = 'Interlaced'
            '4' = 'Non interlaced'

        }

        $VideoMemoryType = @{

            '1' = 'Other'
            '2' = 'Unknown'
            '3' = 'VRAM'
            '4' = 'DRAM'
            '5' = 'SRAM'
            '6' = 'WRAM'
            '7' = 'EDO RAM'
            '8' = 'Burst synchronous DRAM'
            '9' = 'Pipelined burst SRAM'
            '10' = 'CDRAM'
            '11' = '3DRAM'
            '12' = 'SDRAM'
            '13' = 'SGRAM'

        }

        Function Show-Output ($Computer, $Values, $Status) {

            [PSCustomObject]@{

                ComputerName = $Computer
                Caption = $Values.Caption
                DeviceID = $Values.DeviceID
                AdapterCompatibility = $Values.AdapterCompatibility
                AdapterDACType = $Values.AdapterDACType
                AdapterRAM = "$(($Values.AdapterRAM) / 1GB)$(' GB')"
                Availability = $VideoAvailability["$($Values.Availability)"]
                VideoArchitecture = $VideoArchitecture["$($Values.VideoArchitecture)"]
                CurrentBitsPerPixel = $Values.CurrentBitsPerPixel
                CurrentHorizontalResolution = $Values.CurrentHorizontalResolution
                CurrentVerticalResolution = $Values.CurrentVerticalResolution
                CurrentNumberOfColors = $Values.CurrentNumberOfColors
                CurrentNumberOfColumns = $Values.CurrentNumberOfColumns
                CurrentNumberOfRows = $Values.CurrentNumberOfRows
                CurrentRefreshRate = $Values.CurrentRefreshRate
                CurrentScanMode = $VideoScanMode["$($Values.CurrentScanMode)"]
                MaxMemorySupported = $Values.MaxMemorySupported
                MaxNumberControlled = $ValuesMaxNumberControlled
                MaxRefreshRate = $Values.MaxRefreshRate
                MinRefreshRate = $Values.MinRefreshRate
                Monochrome = $Values.Monochrome
                VideoMemoryType = $VideoMemoryType["$($Values.VideoMemoryType)"]
                VideoProcessor = $Values.VideoProcessor
                DriverVersion = $Values.DriverVersion
                Status = $Status

            }

        }

    }

    PROCESS {

        ForEach ($Computer In $ComputerName) {

            If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) {

                Try {

                    $Data = Get-WmiObject Win32_VideoController -ComputerName $Computer | Select-Object *

                    ForEach ($Item In $Data) {

                        Show-Output $Computer.ToUpper() $Item 'Ok'

                    }

                }

                Catch {

                    Show-Output $Computer.ToUpper() $Null $PSItem.Exception.Message

                }

            }

            Else {

                Show-Output $Computer.ToUpper() $Null 'Unreachable'

            }

        }

    }

    END {}

}