Get serial# from WMIMonitorID – wrong format, what am I missing?

Welcome Forums General PowerShell Q&A Get serial# from WMIMonitorID – wrong format, what am I missing?

Viewing 3 reply threads
  • Author
    Posts
    • #252857
      Participant
      Topics: 1
      Replies: 1
      Points: 17
      Rank: Member

      Here my short script – PC info comes through but monitor serial number doesn’t look right.

      Help.

      # Computer Info for current PC
      cls

      $CS = Get-WmiObject -Class Win32_ComputerSystem
      $Monitor = Get-CimInstance -Namespace root\wmi -ClassName wmimonitorid

      New-Object -Typename psobject -Property @{
      Model = $CS.Model
      PCName = $CS.Name
      “Monitor Serial Number” = $Monitor.$_.SerialNumberID
      }

    • #252893
      Participant
      Topics: 8
      Replies: 568
      Points: 2,170
      Helping Hand
      Rank: Community Hero

      The data returned in SerialNumberID is a byte array. You can convert it like this.

      However, if you have more than one monitor you will end up with all serial numbers.

    • #252902
      Participant
      Topics: 8
      Replies: 568
      Points: 2,170
      Helping Hand
      Rank: Community Hero

      Here’s one way to account for multiple monitors.

      Output on my PC

    • #253634
      Participant
      Topics: 1
      Replies: 1
      Points: 17
      Rank: Member

      Thank you, Doug. This is what I was looking for, [System.Text.Encoding]::ASCII.GetString.

      Like you comments suggested, I will have to use both script versions because we have mixed setups: Single and dual monitors.

      All the best, Gideon.

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