Help with remotely inventory Monitor Serial Number with computer list

I am trying to get inventory of all the monitor connected to the Windows OS, more specifically the Serial Number. I found this great powershell script online but the issue is that I need to remotely query thousands of machines so see if it can feed a txt file with a list of computer names. I modified to add the Get-Content and Export-csv. The issue is it just stops at the first computer in the txt file and does not proceed. Any assistance will be greatly appreciated.

$ComputerName = Get-Content -Path C:\Temp\Computers.txt
Get-CimInstance -Namespace root\wmi -ClassName wmimonitorid -ComputerName $ComputerName | foreach {
New-Object -TypeName psobject -Property @{
Manufacturer = ($_.ManufacturerName -notmatch '^0$' | foreach {[char]$_}) -join ""
Name = ($_.UserFriendlyName -notmatch '^0$' | foreach {[char]$_}) -join ""
Serial = ($_.SerialNumberID -notmatch '^0$' | foreach {[char]$_}) -join ""
}  | Export-csv C:\Temp\TEST.csv -Append }

Hi there,

Ensure you have the list of computer names each one per line without any delimiter, and also add the PSComputerName to your output to identify the record from, other than that I don’t see any issues here, and it is working fine with me.

$ComputerName = Get-Content -Path C:\Temp\Computers.txt
Get-CimInstance -Namespace root\wmi -ClassName wmimonitorid -ComputerName $ComputerName | ForEach-Object {
    New-Object -TypeName psobject -Property @{
        ComputerName = $_.PSComputerName
        Manufacturer = ($_.ManufacturerName -notmatch '^0$' | ForEach-Object { [char]$_ }) -join ""
        Name         = ($_.UserFriendlyName -notmatch '^0$' | ForEach-Object { [char]$_ }) -join ""
        Serial       = ($_.SerialNumberID -notmatch '^0$' | ForEach-Object { [char]$_ }) -join ""
    }
} | Export-csv C:\Temp\TEST.csv

Thank you.

I just ran with your updated code and its the same issue. The TEST.csv is not displaying the ComputerName… its showing System.Object for each entry. Everything else looks good, as its showing all the connected monitors for the computer and their SerialNumber. Somehow, it can’t loop back to display the Computer name in the txt to show on the TEST.csv file. This works fine for you?

 

ComputerName
System.Object[]
System.Object[]
System.Object[]
System.Object[]
System.Object[]

Sorry, one important info that I left out is…this works fine when there is only 1 computer name in the txt file. If there are more than 1 computer name, the TEST.csv will not display the ComputerName properly. It will show System.Object

I screwed up, when I copied your code and tried to test it… it was running my old copy of the code. It is working now. Thanks alot Kiran

This script is working, however it is not returning the complete serial number of the monitor. The script returned “N01VP24P31XS” and the complete serial number of the monitor is “CN0N01VP6418024P31XS”. What would be causing part of the serial number to not display?

You’re not the first person to run into this:

So basically, given the serial number CN-0N01VP-64180-24P-31XS

  • CN identifies the country where the monitor was manufactured
  • N01VP is a Dell part number, padded with a leading zero (this will be consistent for all monitors of the same type)
  • 64180 identifies the factory where the monitor was manufactured
  • 24P is a date of manufacture code (Y/M/D)
  • 31XS is a manufacturer code (this is the actual identifier that should be unique to each monitor)

Of this information, it seems that Dell does not program the country code, leading zero of the part number, or factory code into the identification information on the monitor itself. It’s not an issue with the script, it’s a limitation of the information that Dell programs in when the monitor is manufactured.