Obtain Monitor Manufacturer Information Using PowerShell

Have a dream? Start learning your way toward it with courses from $12.99. Shop now for extra savings1px

I wanted to be able to obtain information on a monitor attached to a Windows 10 desktop system, including the manufacturer, model number, serial number, and date of manufacture, from a command-line interface (CLI). One way to do that is by using PowerShell, which Microsoft provides as part of its Windows operating system. You can open a PowerShell window on a Microsoft Windows 10 system by typing PowerShell in the "Type here to search" field at the bottom of the Windows display. You should see the Windows PowerShell app listed as an option you can click on to open a PowerShell window. If you type gwmi WmiMonitorID -Namespace root\wmi at the prompt and hit enter, you will see information similar to the following output displayed.

PS C:\> gwmi WmiMonitorID -Namespace root\wmi


__GENUS                : 2
__CLASS                : WmiMonitorID
__SUPERCLASS           : MSMonitorClass
__DYNASTY              : MSMonitorClass
__RELPATH              : WmiMonitorID.InstanceName="DISPLAY\\HPN360C\\5&2c03a83e&0&UID262_0"
__PROPERTY_COUNT       : 9
__DERIVATION           : {MSMonitorClass}
__SERVER               : YTTERBIUM
__NAMESPACE            : root\wmi
__PATH                 : \\YTTERBIUM\root\wmi:WmiMonitorID.InstanceName="DISPLAY\\HPN360C\\5&2c03a83e&0&UID262_0"
Active                 : True
InstanceName           : DISPLAY\HPN360C\5&2c03a83e&0&UID262_0
ManufacturerName       : {72, 80, 78, 0...}
ProductCodeID          : {51, 54, 48, 67...}
SerialNumberID         : {67, 78, 75, 48...}
UserFriendlyName       : {72, 80, 32, 51...}
UserFriendlyNameLength : 13
WeekOfManufacture      : 12
YearOfManufacture      : 2020
PSComputerName         : YTTERBIUM



PS C:\>

In the above output, you can see that the name of the manufacturer, product code id, serial number, etc. are displayed as a sequence of number, i.e., in a format that is not readily human-interpretable. The following PowerShell script, which is a modified version of one provided by Nicholas Bundy at Get monitor Manufacturer, Model, and serial number, will reformat that information to a format more readily understandable. You can save the code as a .ps1 script file or you can just copy and paste it into a PowerShell window and then hit Enter to see the output.

function Decode {
    If ($args[0] -is [System.Array]) {
        [System.Text.Encoding]::ASCII.GetString($args[0])
    }
    Else {
        "Not Found"
    }
}

ForEach ($Monitor in Get-WmiObject WmiMonitorID -Namespace root\wmi) {  
    $Manufacturer = Decode $Monitor.ManufacturerName -notmatch 0
    $Name = Decode $Monitor.UserFriendlyName -notmatch 0
    $Serial = Decode $Monitor.SerialNumberID -notmatch 0
    $ManufactureWeek = (Get-WmiObject WmiMonitorID -Namespace root\wmi).WeekofManufacture
    $ManufactureYear = (Get-WmiObject WmiMonitorID -Namespace root\wmi).YearOfManufacture
	
    echo "Manufacturer: $Manufacturer`nName: $Name`nSerial Number: $Serial"
    echo "Week of Manufacture: $ManufactureWeek"
    echo "Year of Manufacture: $ManufactureYear"
}

In the above code, a backtick character followed by an "n" produces a new line in the output. You could also put output on a new line by using additional echo commands. Or if you prefer to have the output all on one line, you could replace the instances of `n with a comma followed by a space.

If you paste the above code into a PowerShell window and then hit Enter, you should see results similar to those below.



PS C:\> function Decode {
>>     If ($args[0] -is [System.Array]) {
>>         [System.Text.Encoding]::ASCII.GetString($args[0])
>>     }
>>     Else {
>>         "Not Found"
>>     }
>> }
PS C:\>
PS C:\> ForEach ($Monitor in Get-WmiObject WmiMonitorID -Namespace root\wmi) {
>>     $Manufacturer = Decode $Monitor.ManufacturerName -notmatch 0
>>     $Name = Decode $Monitor.UserFriendlyName -notmatch 0
>>     $Serial = Decode $Monitor.SerialNumberID -notmatch 0
>>     $ManufactureWeek = (Get-WmiObject WmiMonitorID -Namespace root\wmi).WeekofManufacture
>>     $ManufactureYear = (Get-WmiObject WmiMonitorID -Namespace root\wmi).YearOfManufacture
>>
>>     echo "Manufacturer: $Manufacturer`nName: $Name`nSerial Number: $Serial"
>>     echo "Week of Manufacture: $ManufactureWeek"
>>     echo "Year of Manufacture: $ManufactureYear"
>> }
Manufacturer: HPN
Name: HP 32 QHD
Serial Number: CNK0121RH2
Week of Manufacture: 12
Year of Manufacture: 2020
PS C:\>

If you just want the week and year of manufacture of the monitor, you can use the commands shown below.

PS C:\> (Get-WmiObject WmiMonitorID -Namespace root\wmi).WeekofManufacture
12
PS C:\> (Get-WmiObject WmiMonitorID -Namespace root\wmi).YearofManufacture
2020
PS C:\>

The "12" in the output for week of manufacture indicates the monitor was manufactured in March of 2020, which matched the label on the bottom of the HP QHD 32" monitor on which the commands above were run.

Related articles:

  1. Obtaining monitor information from a PowerShell Prompt
  2. Viewing monitor information on a Windows system with DumpEDID

References:

  1. Get monitor Manufacturer, Model, and serial number
    By: myke_deabreau
    Date: November 25, 2014
    Spiceworks
  2. Is there any way to determine the monitor size attached to a computer?
    By: joe647
    Date: April 4, 2013
    Spiceworks
  3. WmiMonitorID class
    Date: May 31, 2018
    Microsoft Docs