Help with remotely inventory Monitor Serial Number with computer list

Welcome Forums General PowerShell Q&A Help with remotely inventory Monitor Serial Number with computer list

Viewing 6 reply threads
  • Author
    Posts
    • #200552
      Participant
      Topics: 1
      Replies: 3
      Points: 18
      Rank: Member

      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 }
    • #200561
      Moderator
      Topics: 3
      Replies: 212
      Points: 1,130
      Helping Hand
      Rank: Community Hero

      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.

    • #200621
      Participant
      Topics: 1
      Replies: 3
      Points: 18
      Rank: Member

      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[]
      • This reply was modified 2 months ago by namahs13.
    • #200627
      Participant
      Topics: 1
      Replies: 3
      Points: 18
      Rank: Member

      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[]

    • #200645
      Participant
      Topics: 1
      Replies: 3
      Points: 18
      Rank: Member

      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

    • #201816
      Participant
      Topics: 0
      Replies: 1
      Points: 6
      Rank: Member

      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?

    • #201984
      Senior Moderator
      Topics: 3
      Replies: 121
      Points: 638
      Helping Hand
      Rank: Major Contributor

      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:
      https://www.dell.com/community/Monitors/Serial-number-question/td-p/4739805
      https://www.dell.com/community/Monitors/WMI-query-for-monitor-serial-number-2/td-p/7292875
      https://www.dell.com/community/Monitors/Different-serial-numbers-of-U3014-monitor-on-the-back-panel-and/td-p/4611946

      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.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.