' Read and parse the monitor EDID information from the ' registry in order to retrieve asset information. ' ' Based on a script by Michael Baird: ' http://cwashington.netreach.net/depo/view.asp?Index=980&ScriptType=vbscript ' ' (Re)written by Rob van der Woude ' http://www.robvanderwoude.com Option Explicit Dim arrKeys, arrRawEDID, arrSubKeys, i, j, objReg, strComputer, strDeviceDesc Dim strMfg, strModel, strKeyPath, strSerial, strSubKeyPath, strSubSubKeyPath 'Hive Constants Const HKEY_CLASSES_ROOT = &H80000000 Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 Const HKEY_USERS = &H80000003 Const HKEY_PERFORMANCE_DATA = &H80000004 Const HKEY_CURRENT_CONFIG = &H80000005 Const HKEY_DYN_DATA = &H80000006 'RegFormat Constants Const REG_NONE = 0 Const REG_SZ = 1 Const REG_EXPAND_SZ = 2 Const REG_BINARY = 3 Const REG_DWORD = 4 Const REG_DWORD_LITTLE_ENDIAN = 4 Const REG_DWORD_BIG_ENDIAN = 5 Const REG_LINK = 6 Const REG_MULTI_SZ = 7 Const REG_RESOURCE_LIST = 8 strComputer = "127.0.0.1" Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//" & strComputer & "/root/default:StdRegProv" ) strKeyPath = "SYSTEM\CurrentControlSet\Enum\DISPLAY" objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrKeys If IsArray( arrKeys ) Then For i = 0 To UBound( arrKeys ) If InStr( 1, arrKeys( i ), "default", vbTextCompare ) < 1 Then strSubKeyPath = strKeyPath & "\" & arrKeys( i ) objReg.EnumKey HKEY_LOCAL_MACHINE, strSubKeyPath, arrSubKeys If IsArray( arrSubKeys ) Then For j = 0 To UBound( arrSubKeys ) strSubSubKeyPath = strSubKeyPath & "\" & arrSubKeys( j ) objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubSubKeyPath, "Mfg", strMfg If IsNull( strMfg ) Then WScript.Echo "No value found for HKLM\" & strSubSubKeyPath & "\Mfg" Else If Left( strMfg, 1 ) <> "(" Then objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubSubKeyPath, "DeviceDesc", strDeviceDesc objReg.GetBinaryValue HKEY_LOCAL_MACHINE, strSubSubKeyPath & "\Device Parameters", "EDID", arrRawEDID If IsArray( arrRawEDID ) Then Test 54 Test 72 Test 90 Test 108 End If WScript.Echo "Manufacturer Name = " & strMfg WScript.Echo "Device Description = " & strDeviceDesc WScript.Echo "Model (EDID) = " & strModel WScript.Echo "Serial# (EDID) = " & strSerial End If End If Next End If End If Next End If Sub Test( ByVal myIndex ) Dim idx, arrTemp, arrTestModel, arrTestSerial, blnModel, blnSerial, strTemp arrTestModel = Split( "0 0 0 252" ) arrTestSerial = Split( "0 0 0 255" ) blnModel = True blnSerial = True For idx = 0 To 3 If CInt( arrTestModel( idx ) ) <> CInt( arrRawEDID( idx + myIndex ) ) Then blnModel = False If CInt( arrTestSerial( idx ) ) <> CInt( arrRawEDID( idx + myIndex ) ) Then blnSerial = False Next If blnModel Or blnSerial Then For idx = 4 To 17 Select Case arrRawEDID( myIndex + idx ) Case 0 strTemp = strTemp & " " Case 7 strTemp = strTemp & " " Case 10 strTemp = strTemp & " " Case 13 strTemp = strTemp & " " Case Else strTemp = strTemp & Chr( arrRawEDID( myIndex + idx ) ) End Select Next strTemp = Trim( strTemp ) If InStr( strTemp, " " ) Then arrTemp = Split( strTemp, " " ) strTemp = arrTemp(0) End If If blnModel Then strModel = strTemp If blnSerial Then strSerial = strTemp End If End Sub