Page 1 of 2 12>
Topic Options
#125607 - 2004-08-25 06:51 PM Monitor Serial
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Trying to get the monitor serial number.. I have tried to use

WMIQuery("MonitorManufacturer","Win32_DesktopMonitor",$cn)

But there is no entry for the monitor serial number in WMI, but if you look in AIDA32 under "Display/Monitor", there is a serial number entry for the monitor.

Is there any way to get this info?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125608 - 2004-08-25 07:18 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I bet aida is not looking for the info from windows like wmi does, but goes beyond and gets the value from bios.

still, that's a quess.
need to check that out.
_________________________
!

download KiXnet

Top
#125609 - 2004-08-25 07:23 PM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Did you try the PNPDeviceID in Win32_DesktopMonitor? Just a shot in the dark, after glancing through all the Sciptomatic classes. It seems to atleast have the model and some other long number..not sure if its serial or not...since im sitting in a class i cant really walk around and check the back for the SN right now

I didnt see anything about the monitor SN in the BIOS class though, unless its just not listed in the scriptomatic tool.

Top
#125610 - 2004-08-25 07:26 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
me can't really check either as don't have desktop but laptop monitor
_________________________
!

download KiXnet

Top
#125611 - 2004-08-25 08:05 PM Re: Monitor Serial
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
In addition to Aida32, also found - http://www.entechtaiwan.com/files/moninfo.exe However, have not figured out how to query remote pcs. There is also supposed to be some info within the registry "HKEY_LOCAL_MACHINE\system\currentcontrolset\enum\display\<device id>" that has this as well.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125612 - 2004-08-25 08:55 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
the hardware ID looks the same as the subkeys of display...

does someone have a monitor that could be checked against?
_________________________
!

download KiXnet

Top
#125613 - 2004-08-25 09:28 PM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
ok i did find the SN in that reg key...But its in binary included with a bunch of other info and not easy to notice...But on my pc here its in...

HKLM\System\CurrentControlSet\Enum\Display\<PNPDeviceID>\device parameters

in the EDID value.

If someone has a UDF or something that will convert the binary then you should be able to extract it out.

Code:

$strComputer = "."
$objWMIService = GetObject("winmgmts:\\"+$strComputer+"\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)
For Each $objItem in $colItems
$pnp = $objItem.PNPDeviceID
Next
$snbinary = ReadValue("HKLM\SYSTEM\CurrentControlSet\Enum\"+$pnp+"\Device Parameters","EDID")
? $pnp
? $snbinary
get $


Top
#125614 - 2004-08-25 11:10 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is nothing to be converted in binary.

but, you need to dig the data for us if you are not able to translate what the fields are by yourself.
need the serial and the binary string.
_________________________
!

download KiXnet

Top
#125615 - 2004-08-26 08:06 AM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
im back on my laptop till morning so i cant check it again right now. the only way i can read it is to open the value in regedit...so i will try to just take a snapshot or something and post tomorrow am.

maybe this is a stupid question....But how the heck does the monitor s/n get in the registry to begin with? is there some kind of bi-communication through the vga cable or what?

Top
#125616 - 2004-08-26 09:29 AM Re: Monitor Serial
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

maybe this is a stupid question....But how the heck does the monitor s/n get in the registry to begin with? is there some kind of bi-communication through the vga cable or what?




http://www.webopedia.com/TERM/E/EDID.html

Top
#125617 - 2004-08-26 09:33 AM Re: Monitor Serial
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
...and here is a VBScript to parse the EDID information.

You should be able to convert to KiXtart with a little effort.

http://cwashington.netreach.net/depo/view.asp?Index=980&ScriptType=vbscript

Top
#125618 - 2004-08-26 10:30 AM Re: Monitor Serial
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here is a quick version which displays just the model number and serial number (if present):

See later post for updated code.


Edited by Richard H. (2004-09-07 11:53 AM)

Top
#125619 - 2004-08-26 02:20 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
so, next question is, do we want all displays that have been attached or just current.
_________________________
!

download KiXnet

Top
#125620 - 2004-08-26 02:32 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this laptop thing gets it little harder.
windows says I have 3 monitors.
that's because the radeon tells it so.
there is no other monitors attached.

well, then going to this key and I see (in addition to default monitor) 5 keys.
how to pick the correct one?
_________________________
!

download KiXnet

Top
#125621 - 2004-08-26 03:22 PM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Does the WMI call i posted earlier have more than one listed for you Lonk? If not then I would use that to select the correct one.
Top
#125622 - 2004-08-26 03:33 PM Re: Monitor Serial
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, it displays only one.
but then, I only have 1 desktop monitor in monitors.
generic television and flat panel don't fit the definition.

will check better later.
_________________________
!

download KiXnet

Top
#125623 - 2004-08-26 04:02 PM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I combined the code that Richard posted into 2 different UDFs. 1 for SN and 1 for Model. Not sure which would be better...Using WMI or EnumKey to get the correct display key. But I used WMI since it seems to work fine for me. What do you guys think?

Code:
Break ON

$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")

MonitorSN()
?
MonitorMod()

get $

FUNCTION MonitorSN(OPTIONAL $computer)
Dim $objWMIService,$colItems,$Item,$pnp,$sEDID,$ioffset,$sblock,$c,$s
If $computer = ""
$computer = "."
Endif
$objWMIService = GetObject("winmgmts:\\"+$computer+"\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)
For Each $Item in $colItems
$pnp = $Item.PNPDeviceID
Next
$sEDID = ReadValue("HKLM\SYSTEM\CurrentControlSet\Enum\"+$pnp+"\Device Parameters","EDID")
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
If Left($sBlock,8)="000000ff"
$s = SubStr($sBlock,9)
While $s
$c=Execute("Exit &"+Left($s,2))
If $c=10
Exit 0
EndIf
If $c
$MonitorSN=$MonitorSN+Chr($c)
EndIf
$s=SubStr($s,3)
Loop
EndIf
Next
ENDFUNCTION

FUNCTION MonitorMod(OPTIONAL $computer)
Dim $objWMIService,$colItems,$Item,$pnp,$sEDID,$ioffset,$sblock,$c,$s
If $computer = ""
$computer = "."
Endif
$objWMIService = GetObject("winmgmts:\\"+$computer+"\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)
For Each $Item in $colItems
$pnp = $Item.PNPDeviceID
Next
$sEDID = ReadValue("HKLM\SYSTEM\CurrentControlSet\Enum\"+$pnp+"\Device Parameters","EDID")
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
If Left($sBlock,8)="000000fc"
$s = SubStr($sBlock,9)
While $s
$c=Execute("Exit &"+Left($s,2))
If $c=10
Exit 0
EndIf
If $c
$MonitorMod=$MonitorMod+Chr($c)
EndIf
$s=SubStr($s,3)
Loop
EndIf
Next
ENDFUNCTION


Top
#125624 - 2004-08-26 04:24 PM Re: Monitor Serial
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

hmm...
so, next question is, do we want all displays that have been attached or just current.




Hmm...

On my machine (which has a couple of monitors defined) it only reports the active one.

I use the check for the "Control" subkey to determine if it is current as that's how it seemed to work for me. If you want all monitors, remove the check for the "Control" subkey.

Dealing with multiple active video cards / monitors is an exercise left to the reader

Top
#125625 - 2004-08-26 04:45 PM Re: Monitor Serial
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Here are the same two UDFs except for using the EnumKey as Richard did above. Some more people want to test them and see if they work pretty consistently...? Havent added the remote machine stuff yet but it will be east enough to add.

Code:
Break ON


$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")

MonitorSN()
?
MonitorModel()

get $

FUNCTION MonitorSN(OPTIONAL $computer)
Dim $sEDID,$ioffset,$sblock,$c,$s,$iIndex,$sMonitor
$iIndex=0
$sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)
While Not @ERROR
$sMonitor="HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor+"\"+EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor,0)
If KeyExist($sMonitor+"\Control")
If Instr(ReadValue($sMonitor,"HardwareID"),"Monitor\")=1
$sEDID = ReadValue($sMonitor+"\Device Parameters","EDID")
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
If Left($sBlock,8)="000000ff"
$s = SubStr($sBlock,9)
While $s
$c=Execute("Exit &"+Left($s,2))
If $c=10
Exit 0
EndIf
If $c
$MonitorSN=$MonitorSN+Chr($c)
EndIf
$s=SubStr($s,3)
Loop
EndIf
Next

EndIf
EndIf
$iIndex=$iIndex+1
$sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)
Loop
ENDFUNCTION

FUNCTION MonitorModel(OPTIONAL $computer)
Dim $sEDID,$ioffset,$sblock,$c,$s,$iIndex,$sMonitor
$iIndex=0
$sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)
While Not @ERROR
$sMonitor="HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor+"\"+EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor,0)
If KeyExist($sMonitor+"\Control")
If Instr(ReadValue($sMonitor,"HardwareID"),"Monitor\")=1
$sEDID = ReadValue($sMonitor+"\Device Parameters","EDID")
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
If Left($sBlock,8)="000000fc"
$s = SubStr($sBlock,9)
While $s
$c=Execute("Exit &"+Left($s,2))
If $c=10
Exit 0
EndIf
If $c
$MonitorModel=$MonitorModel+Chr($c)
EndIf
$s=SubStr($s,3)
Loop
EndIf
Next

EndIf
EndIf
$iIndex=$iIndex+1
$sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)
Loop
ENDFUNCTION


Top
#125626 - 2004-08-26 08:29 PM Re: Monitor Serial
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
I get
ERROR : undefined variable [$KEY_DISPLAY]!

for both UDFs

Top
Page 1 of 2 12>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 926 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.075 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org