#125607 - 2004-08-25 06:51 PM
Monitor Serial
|
Kdyer
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
|
Top
|
|
|
|
#125609 - 2004-08-25 07:23 PM
Re: Monitor Serial
|
ShaneEP
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
|
|
|
|
#125611 - 2004-08-25 08:05 PM
Re: Monitor Serial
|
Kdyer
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
|
Top
|
|
|
|
#125613 - 2004-08-25 09:28 PM
Re: Monitor Serial
|
ShaneEP
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
|
|
|
|
#125616 - 2004-08-26 09:29 AM
Re: Monitor Serial
|
Richard H.
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
|
|
|
|
#125623 - 2004-08-26 04:02 PM
Re: Monitor Serial
|
ShaneEP
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
   
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
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
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(mole)
and 378 anonymous users online.
|
|
|