How to get monitor model and serial number via WMI query or class

Started by Shivakumar

Kindly help me to get monitor model and serial number using WMI Command or class.
SoftPerfect Support forum - Andrew avatar image

Re: How to get monitor model and serial number via WMI query or class   21 June 2018, 17:57

You could use the following queries in the root\WMI namespace:
SELECT UserFriendlyName FROM WmiMonitorID
SELECT SerialNumberID FROM WmiMonitorID
However those are byte arrays and will be displayed as [XX, XX, XX, XX, ...].

For human-readable format use the following VB script under Options - Remote Scripting. It will extract the byte arrays for model name and serial number and convert them to ASCII strings:
'Input parameters
strComputer = Input.Current

'Get monitors with WMI
Set objWMIService = GetObject("winmgmts:" _
  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\WMI")
Set colMonitors = objWMIService. _
  ExecQuery("SELECT * FROM WmiMonitorID")
For Each objMonitor in colMonitors
  'Convert serial number to ASCII
  SerialNo = ""
  For I = 0 To Ubound(objMonitor.SerialNumberID)
    SerialNo = SerialNo & Chr(objMonitor.SerialNumberID(I))
  Next
  'Convert model name to ASCII
  ProductId = ""
  For I = 0 To Ubound(objMonitor.UserFriendlyName)
    ProductId = ProductId & Chr(objMonitor.UserFriendlyName(I))
  Next
  Output.Write ProductId & " " & SerialNo
Next

Output example:

SoftPerfect support forum
Dear Team,

Guide me to add script and output column for display. Somehow I tried and I am getting details in codes
SoftPerfect Support forum - Andrew avatar image

Re: How to get monitor model and serial number via WMI query or class   23 June 2018, 18:03

Choose Options - Remote Scripting - New and copy and paste the above script.

Give the new entry a name and make sure it's ticked in the list of scripts.

After that, there will be a new column with that name, with the script output.

Reply to this topic

Sometimes you can get the answer faster if you try the forum search and/or have a look at the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **      **   *******   **      **  **      **  ******** 
 **  **  **  **     **  **  **  **  **  **  **     **    
 **  **  **  **         **  **  **  **  **  **     **    
 **  **  **  ********   **  **  **  **  **  **     **    
 **  **  **  **     **  **  **  **  **  **  **     **    
 **  **  **  **     **  **  **  **  **  **  **     **    
  ***  ***    *******    ***  ***    ***  ***      **    

Message: