Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Win32_DesktopMonitor List Enumerate Screen Monitors Asset Hardware Make Manufacturer Model Serial Number Win32_MonitorDesktop
The best example I've found uses the Win32_DesktopMonitor Class to get a list of monitors.
Problem:
It only works for a single monitor and not multiple monitors on my system.
Do any of you have Winbatch scripts I'm looking for the monitor's make/model/serial
Reference:
msdn.microsoft.com/en-us/library/aa394122(VS.85).aspx
It took me a while to find a solution other than using the WMI Win32_DesktopMonitor. Give this code a try, it manages to list all my monitors, on a multi monitor system. It basically reads the data from the registry. This might require administrative level access because it attempts to read a protected portion of the registry HKEY_LOCAL_MACHINE:
#DefineSubRoutine ParseBinaryData( myIndex ) arrTestModel = Arrayize( "0 0 0 252", " " ) arrTestSerial = Arrayize( "0 0 0 255", " " ) blnModel = @TRUE blnSerial = @TRUE strTemp = "" For idx = 0 To 3 index = idx + myIndex If Int( arrTestModel[idx] ) <> Int( arrRawEDID[index] ) Then blnModel = @FALSE If Int( arrTestSerial[idx] ) <> Int( arrRawEDID[idx + myIndex] ) Then blnSerial = @FALSE Next If blnModel || blnSerial Then For idx = 4 To 17 Select arrRawEDID[ myIndex + idx ] Case 0 strTemp = strTemp : " " Break Case 7 strTemp = strTemp : " " Break Case 10 strTemp = strTemp : " " Break Case 13 strTemp = strTemp : " " Break Case arrRawEDID[ myIndex + idx ] strTemp = strTemp : Num2Char( arrRawEDID[ myIndex + idx ] ) End Select Next strTemp = StrTrim( strTemp ) If blnModel Then strModel = strTemp If blnSerial Then strSerial = strTemp End If #EndSubRoutine ; Enumerate All Monitors ; Based on code found here http://www.robvanderwoude.com/files/dispedid_vbs.txt strComputer = "." HKEY_LOCAL_MACHINE = 2147483650 strMsg = "" strModel="" strSerial="" objReg = ObjectGet( "winmgmts:{impersonationLevel=impersonate}!//" : strComputer : "/root/default:StdRegProv" ) arrKeys = ArrDimension(999) strKeyPath = "SYSTEM\CurrentControlSet\Enum\DISPLAY" objReg.EnumKey ( HKEY_LOCAL_MACHINE, strKeyPath, arrKeys ) For i = 0 To ArrInfo(arrKeys,1)-1 strSubKeyPath = strKeyPath : "\" : arrKeys[i] arrSubKeys = ArrDimension(999) objReg.EnumKey (HKEY_LOCAL_MACHINE, strSubKeyPath, arrSubKeys) For j = 0 To ArrInfo(arrSubKeys,1)-1 strSubSubKeyPath = strSubKeyPath : "\" : arrSubKeys[j] arrSub2 = ArrDimension(999) objReg.EnumKey( HKEY_LOCAL_MACHINE, strSubSubKeyPath, arrSub2 ) blnControl = @FALSE For k = 0 To ArrInfo(arrSub2,1)-1 If arrSub2[k] == "Control" Then blnControl = @TRUE Next If blnControl strMfg = "" objReg.GetStringValue( HKEY_LOCAL_MACHINE, strSubSubKeyPath, "Mfg", strMfg) If strMfg == "" Then strMfg = "unknown" If StrIndex( strMfg, ";", 1, @FWDSCAN ) Then strMfg = StrSub( strMfg, StrIndex( strMfg, ";", 1, @FWDSCAN )+1, -1 ) strDeviceDesc = "" objReg.GetStringValue(HKEY_LOCAL_MACHINE, strSubSubKeyPath, "DeviceDesc", strDeviceDesc) If strDeviceDesc == "" Then strDeviceDesc = "unknown" If StrIndex( strDeviceDesc, ";", 1, @FWDSCAN ) Then strDeviceDesc = StrSub( strDeviceDesc, StrIndex( strDeviceDesc, ";", 1, @FWDSCAN )+1, -1 ) arrBadEDID = ArrDimension(9999) arrRawEDID = ArrDimension(9999) strSubSubKeyPath = strSubSubKeyPath : "\Device Parameters" objReg.GetBinaryValue(HKEY_LOCAL_MACHINE, strSubSubKeyPath, "BAD_EDID", arrBadEDID) If ObjectTypeGet( arrBadEDID ) != "ARRAY" Then objReg.GetBinaryValue(HKEY_LOCAL_MACHINE, strSubSubKeyPath , "EDID", arrRawEDID) ParseBinaryData( 54 ) ParseBinaryData( 72 ) ParseBinaryData( 90 ) ParseBinaryData( 108 ) If StrMsg != "" Then strMsg = strMsg : @CRLF strMsg = strMsg : "Manufacturer = " : strMfg : @CRLF : "Description = " : strDeviceDesc : @CRLF : "Model (EDID) = " : strModel : @CRLF : "Serial# (EDID) = " : strSerial : @CRLF End If End If Next Next Pause("Asset List - Monitors",strMsg ) Exit
Article ID: W18475
Filename: List All Monitors.txt
File Created: 2012:04:11:07:29:42
Last Updated: 2012:04:11:07:29:42