🖥️ Get information about connected monitor

At work Helpdesk did receive multiple complaints regarding a specific manufacture and model of monitors. And many of our user can’t look at the back of the monitor to see the brand or model and even harder to see the serial number of the monitor. Also we wanted to know if the monitor was inside the warranty period or not.

So I was thinking and created a little function for this that can collect the following information from either local or remote computer.
It can also collect information from multiple remote computers at the same time.

If you use this function on a remote computer you need to make sure that you have WinRM activated.

  • Is the monitor active? (connected)
  • Manufacturer Name
  • Model
  • Serial Number
  • Year Of Manufacture
  • Week Of Manufacture

Links

2022-07-16
Updated so you can collect monitor information from multiple monitor at the same time, did also change name from Show-MonitorInformation to Get-MonitorInformation.

Code
(Sometime I’m updating the code in GitHub so to be sure that you se the most up to date code please visit the Script file)

<#
    Copyright (C) 2022  Stolpe.io
    <https://stolpe.io>
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
#>

Function Get-MonitorInformation {
    <#
        .SYNOPSIS
        Returns information about all the monitors that has been connected to the computer
        .DESCRIPTION
        With this script you can get information about all of the monitors that has been connected to a local or remote computer.
        You can also run this against multiple remote computers at the same time.
        .PARAMETER Computer
        If you want to run this against a remote computer you specify which computer with this parameter.
        .EXAMPLE
        Get-MonitorInformation
        Returns the information about the monitors on the local computer

        Get-MonitorInformation -ComputerName "Win11"
        Return information about the monitor on a remote computer named "Win11"

        Get-MonitorInformation -ComputerName "Win10,Win11"
        Return information about the monitor from both remote computer named Win10 and Win11

    #>

    [CmdletBinding()]
    Param(
        [String]$ComputerName = "localhost"
    )

    foreach ($Computer in $ComputerName.Split(",").Trim()) {
        try {
            Write-Host "`n== Monitor information from $($Computer) ==`n"
            Get-CimInstance -ComputerName $Computer -ClassName WmiMonitorID -Namespace root\wmi | Foreach-Object {
                [PSCustomObject]@{
                    Active                = $_.Active
                    'Manufacturer Name'   = ($_.Manufacturername | ForEach-Object { [char]$_ }) -join ""
                    'Model'               = ($_.UserFriendlyName | ForEach-Object { [char]$_ }) -join ""
                    'Serial Number'       = ($_.SerialNumberID | ForEach-Object { [char]$_ }) -join ""
                    'Year Of Manufacture' = $_.YearOfManufacture
                    'Week Of Manufacture' = $_.WeekOfManufacture
                }
            } | Format-Table
        }
        catch {
            Write-Error "$($PSItem.Exception)"
            Continue
        }
    }
}
Posts created 10

2 thoughts on “🖥️ Get information about connected monitor

  1. Can you explain how these properties are translated from their raw values to something readable, like how a ‘UserFriendlyName’ of ‘68,69,76,76,80,50,52,49,57,72,0,0’ becomes ‘DELL P2419H’?

    This line:
    ($_.UserFriendlyName | ForEach-Object {[char]$_ } ) -join “”
    seems to be doing the work but I don’t understand it.

    1. It’s ASCII that are translate with the [char]$_
      So what it does is that for each numbers before , it translates from ASCII to readable.
      Then it joins everything together as it’s only translate one “combo” at the time for example 68 then it translate 69 etc.

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top
%d bloggers like this: