none
How to get serial numbers of monitors from remote computers

    Question

  • Hi everyone,

    I am new to scripting and just started to use PowerShell.  I tried to get get serial numbers of monitors from remote computers and tried the following line on my own PC but get a message said, "Get-Wmiobject : Invalid Class".

    The code that I used is

    $trComputer = "."
    $collection = get-wmiobject -class "WinMonitorID" -namespace "root\WMI -computername $trComputer

    I found this class from the WMI Reference but I cannot not see it in the WMI Object Browser.

    Kind Regards
    Han
    Wednesday, June 17, 2009 4:04 AM

Answers

All replies

  • You must have got the class name wrong. Where in the reference did you find WinMonitorID?
    You also miss the closing quotes around root\WMI. I suspect root\WMI is wrong too. Most hardware related classes are found in the root\cimv2 namespace.
    Wednesday, June 17, 2009 7:25 AM
  • It is actually WmiMonitorID and I beleive it is available on Vista and above (PowerShell v2 solution):

    PS > $monitor = gwmi WmiMonitorID -Namespace root\wmi
    PS > ($monitor.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join ""
    SAM

    PS > ($monitor.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join ""
    SyncMaster

    PS > ($monitor.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join ""
    HVCP901666



    Shay Levy [MVP]
    http://blogs.microsoft.co.il/blogs/ScriptFanatic
    PowerShell Toolbar
    Wednesday, June 17, 2009 1:24 PM
    Moderator
  • Nice, i didn't know about that one. 
    Any experiences about it? How well does it work? I mean how many monitors supply this information?
    Wednesday, June 17, 2009 1:28 PM
  • Many thanks for all the messages.  I will try it out and let you know.
    Thursday, June 18, 2009 1:11 AM
  • Hi,

    I am sorry for not getting back to this for a while.

    I did found out that this class is not available on XP and I have to work with XP for the moment.  I try this on Windows 7 and it works.  Many thanks
    Monday, August 31, 2009 4:20 AM
  • There is a way to get Monitor Serial Numbers in XP (it's not pretty, but it works...it involves using remote registry, and parsing a binary registry value)  I just posted a script that will do this on my blog:

    http://www.hackyeah.com/2010/08/powershell-pc-info-script-wmi/

    Tuesday, August 10, 2010 5:05 PM
  • Many thanks Trenton.ivey

    I actually found a VB script that was written by Michael Baird and had rewritten it in Powershell that does that same job as the Monitor Serial Numbers (registry) part in your script.

    I like your script and trying to learn how to use the data objects.

     

    Kind regards

    Han


    Wednesday, August 11, 2010 2:20 AM
  • Nice!

    For multiple monitors:

    gwmi WmiMonitorID -Namespace root\wmi | ForEach-Object {($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join ""; ($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join ""}
    
    
    

    DELL 007W
    H73074QE5L
    DELL 1905
    W86905BG1EBA

    Karl


    http://unlockpowershell.wordpress.com
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    Wednesday, August 11, 2010 2:07 PM
  • Many thanks for this.

    For getting monitor serial numbers, it is much easier on Windows Vista and later than on XP.

    Thursday, August 12, 2010 12:36 AM