Archive

Archive for the ‘SCCM Reports’ Category

Monitor Information

April 23, 2010 Leave a comment

Summary:

***NOT A SUPPORTED SOLUTION!  USE WITH CAUTION!  THIS REQUIRES MODIFICATION OF THE MOF.***

Below you will find all of the elements I used to get an inventory of the monitors in our environment.  I referenced a script from Michael Baird and MOF data from Sherry Kissinger but added many of my own changes.  If you deploy the script to the devices first and then modify the MOF this should work well for you as it has for me.

image

Script:

‘————————————————————————
‘Monitor Information Discovery
‘Referenced code by Michael Baird – Monitor EDID Information v1.2
‘————————————————————————

Const DISPLAY_REGKEY="HKLMSYSTEMCurrentControlSetEnumDISPLAY"
Const DEBUGFILE="NUL"
Const DEBUGMODE=0

on error resume next
Dim blnRegDump,strRegDumpLoc
blnRegDump=1
strRegDumpLoc="SOFTWAREToolsMonitorInfo"  ‘must have trailing
Const REGDUMPHIVE=&H80000002 ‘hklm

DebugOut "Execution Started " & cstr(now)
GetMonitorInfo() ‘just write the output to screen
DebugOut "Execution Completed " & cstr(now)

‘————————————————–
‘GetMonitorInfo
‘————————————————–
Function GetMonitorInfo()
    debugout "Getting all display devices"
    arrAllDisplays=GetAllDisplayDevicesInReg()
    debugout "Filtering display devices to monitors"
    arrAllMonitors=GetAllMonitorsFromAllDisplays(arrAllDisplays)
    debugout "Filtering monitors to active monitors"
    arrActiveMonitors=GetActiveMonitorsFromAllMonitors(arrAllMonitors)
    if ubound(arrActiveMonitors)=0 and arrActiveMonitors(0)="{EDID ERROR}" then
        debugout "No active monitors found"
        strFormattedMonitorInfo="[Monitor_1]" & vbcrlf & "Monitor=Not Found" & vbcrlf & vbcrlf
    else
        debugout "Found active monitors"
        debugout "Retrieving EDID for all active monitors"
        arrActiveEDID=GetEDIDFromActiveMonitors(arrActiveMonitors)
        debugout "Parsing EDID/Windows data"
        arrParsedMonitorInfo=GetParsedMonitorInfo(arrActiveEDID,arrActiveMonitors)
        debugout "Formatting parsed data"
        If blnRegDump=1 Then
            DumpMonitorInfoRegistry(arrParsedMonitorInfo)
        Else
            strFormattedMonitorInfo=GetFormattedMonitorInfo(arrParsedMonitorInfo)
            wscript.echo strFormattedMonitorInfo
        End If
    end if
    debugout "Data retrieval completed"
    GetMonitorInfo=strFormattedMonitorInfo
End Function

‘————————————————–
‘GetFormattedMonitorInfo
‘————————————————–

Function GetFormattedMonitorInfo(arrParsedMonitorInfo)
    for tmpctr=0 to ubound(arrParsedMonitorInfo)
        tmpResult=split(arrParsedMonitorInfo(tmpctr),"|||")
        tmpOutput=tmpOutput & "[Monitor_" & cstr(tmpctr+1) & "]" & vbcrlf
        tmpOutput=tmpOutput & "EDID_VESAManufacturerID=" & tmpResult(1) & vbcrlf
        tmpOutput=tmpOutput & "EDID_DeviceID=" & tmpResult(3) & vbcrlf
        tmpOutput=tmpOutput & "EDID_ManufactureDate=" & tmpResult(2) & vbcrlf
        tmpOutput=tmpOutput & "EDID_SerialNumber=" & tmpResult(0) & vbcrlf
        tmpOutput=tmpOutput & "EDID_ModelName=" & tmpResult(4) & vbcrlf
        tmpOutput=tmpOutput & "EDID_Version=" & tmpResult(5) & vbcrlf
        tmpOutput=tmpOutput & "Windows_VESAID=" & tmpResult(6) & vbcrlf
        tmpOutput=tmpOutput & "Windows_PNPID=" & tmpResult(7) & vbcrlf & vbcrlf
    next
    GetFormattedMonitorInfo=tmpOutput
End Function

‘————————————————–
‘GetAllDisplayDevicesInReg
‘————————————————–

Function GetAllDisplayDevicesInReg()
    dim arrResult()
    redim arrResult(0)
    intArrResultIndex=-1
    arrtmpkeys=RegEnumKeys(DISPLAY_REGKEY)

    if vartype(arrtmpkeys)<>8204 then
        arrResult(0)="{EDID ERROR}"
        GetAllDisplayDevicesInReg=false
        debugout "Display=Can’t enum subkeys of display regkey"
    else
        for tmpctr=0 to ubound(arrtmpkeys)
        arrtmpkeys2=RegEnumKeys(DISPLAY_REGKEY & arrtmpkeys(tmpctr))
            for tmpctr2 = 0 to ubound(arrtmpkeys2)
                intArrResultIndex=intArrResultIndex+1
                redim preserve arrResult(intArrResultIndex)
                arrResult(intArrResultIndex)=DISPLAY_REGKEY & arrtmpkeys(tmpctr) & "" & arrtmpkeys2(tmpctr2)
                debugout "Display=" & arrResult(intArrResultIndex)
            next
        next
    end if

    GetAllDisplayDevicesInReg=arrResult
End Function

‘————————————————–
‘GetAllMonitorsFromAllDisplays
‘————————————————–

Function GetAllMonitorsFromAllDisplays(arrRegKeys)
    dim arrResult()
    redim arrResult(0)
    intArrResultIndex=-1

    for tmpctr=0 to ubound(arrRegKeys)
        if IsDisplayDeviceAMonitor(arrRegKeys(tmpctr)) then
            intArrResultIndex=intArrResultIndex+1
            redim preserve arrResult(intArrResultIndex)
            arrResult(intArrResultIndex)=arrRegKeys(tmpctr)
            debugout "Monitor=" & arrResult(intArrResultIndex)
        end if
    next

    if intArrResultIndex=-1 then
        arrResult(0)="{EDID ERROR}"
        debugout "Monitor=Unable to locate any monitors"
    end if
    GetAllMonitorsFromAllDisplays=arrResult
End Function

‘————————————————–
‘IsDisplayDeviceAMonitor
‘————————————————–

Function IsDisplayDeviceAMonitor(strDisplayRegKey)
    arrtmpResult=RegGetMultiStringValue(strDisplayRegKey,"HardwareID")
    strtmpResult="|||" & join(arrtmpResult,"|||") & "|||"
    if instr(lcase(strtmpResult),"|||monitor")=0 then
        debugout "MonitorCheck=’" & strDisplayRegKey & "’|||is not a monitor"
        IsDisplayDeviceAMonitor=false
    else
        debugout "MonitorCheck=’" & strDisplayRegKey & "’|||is a monitor"
        IsDisplayDeviceAMonitor=true
    end if
End Function

‘————————————————–
‘GetActiveMonitorsFromAllMonitors
‘————————————————–

Function GetActiveMonitorsFromAllMonitors(arrRegKeys)
    dim arrResult()
    redim arrResult(0)
    intArrResultIndex=-1
    for tmpctr=0 to ubound(arrRegKeys)
        if IsMonitorActive(arrRegKeys(tmpctr)) then
            intArrResultIndex=intArrResultIndex+1
            redim preserve arrResult(intArrResultIndex)
            arrResult(intArrResultIndex)=arrRegKeys(tmpctr)
            debugout "ActiveMonitor=" & arrResult(intArrResultIndex)
        end if
    next

    if intArrResultIndex=-1 then
        arrResult(0)="{EDID ERROR}"
        debugout "ActiveMonitor=Unable to locate any active monitors"
    end if

    GetActiveMonitorsFromAllMonitors=arrResult
End Function

‘————————————————–
‘IsMonitorActive
‘————————————————–

Function IsMonitorActive(strMonitorRegKey)
    arrtmpResult=RegEnumKeys(strMonitorRegKey)
    strtmpResult="|||" & join(arrtmpResult,"|||") & "|||"

    if instr(lcase(strtmpResult),"|||control|||")=0 then
        debugout "ActiveMonitorCheck=’" & strMonitorRegKey & "’|||is not active"
        IsMonitorActive=false
    else
        debugout "ActiveMonitorCheck=’" & strMonitorRegKey & "’|||is active"
        IsMonitorActive=true
    end if
End Function

‘————————————————–
‘GetEDIDFromActiveMonitors
‘————————————————–

Function GetEDIDFromActiveMonitors(arrRegKeys)
    dim arrResult()
    redim arrResult(0)
    intArrResultIndex=-1
    for tmpctr=0 to ubound(arrRegKeys)
        strtmpResult=GetEDIDForMonitor(arrRegKeys(tmpctr))
        intArrResultIndex=intArrResultIndex+1
        redim preserve arrResult(intArrResultIndex)
        arrResult(intArrResultIndex)=strtmpResult
        debugout "GETEDID=" & arrRegKeys(tmpctr) & "|||EDID,Yes"
    next

    if intArrResultIndex=-1 then
        arrResult(0)="{EDID ERROR}"
        debugout "EDID=Unable to retrieve any edid"
    end if

    GetEDIDFromActiveMonitors=arrResult
End Function

‘————————————————–
‘GetEDIDForMonitor
‘————————————————–

Function GetEDIDForMonitor(strMonitorRegKey)
    arrtmpResult=RegGetBinaryValue(strMonitorRegKey & "Device Parameters","EDID")

    if vartype(arrtmpResult) <> 8204 then
        debugout "GetEDID=No EDID Found|||" & strMonitorRegKey
        GetEDIDForMonitor="{EDID ERROR}"
    else
        for each bytevalue in arrtmpResult
            strtmpResult=strtmpResult & chr(bytevalue)
        next
        debugout "GetEDID=EDID Found|||" & strMonitorRegKey
        debugout "GetEDID_Result=" & GetHexFromString(strtmpResult)
        GetEDIDForMonitor=strtmpResult
    end if
End Function

‘————————————————–
‘GetHexFromString
‘————————————————–

Function GetHexFromString(strText)

    for tmpctr=1 to len(strText)
        tmpresult=tmpresult & right( "0" & hex(asc(mid(strText,tmpctr,1))),2) & ","
    next
    GetHexFromString=left(tmpresult,len(tmpresult)-1)
End Function

‘————————————————–
‘GetParsedMonitorInfo
‘————————————————–

Function GetParsedMonitorInfo(arrActiveEDID,arrActiveMonitors)
    dim arrResult()

    for tmpctr=0 to ubound(arrActiveEDID)
        strSerial=GetSerialFromEDID(arrActiveEDID(tmpctr))
        strMfg=GetMfgFromEDID(arrActiveEDID(tmpctr))
        strMfgDate=GetMfgDateFromEDID(arrActiveEDID(tmpctr))
        strDev=GetDevFromEDID(arrActiveEDID(tmpctr))
        strModel=GetModelFromEDID(arrActiveEDID(tmpctr))
        strEDIDVer=GetEDIDVerFromEDID(arrActiveEDID(tmpctr))
        strWinVesaID=GetWinVESAIDFromRegKey(arrActiveMonitors(tmpctr))
        strWinPNPID=GetWinPNPFromRegKey(arrActiveMonitors(tmpctr))
        redim preserve arrResult(tmpctr)
        arrResult(tmpctr)=arrResult(tmpctr) & strSerial & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strMfg & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strMfgDate & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strDev & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strModel & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strEDIDVer & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strWinVesaID & "|||"
        arrResult(tmpctr)=arrResult(tmpctr) & strWinPNPID
        debugout arrResult(tmpctr)
    next

    GetParsedMonitorInfo=arrResult
End Function

‘————————————————–
‘GetWinVESAIDFromRegKey
‘————————————————–

Function GetWinVESAIDFromRegKey(strRegKey)
    if strRegKey="{EDID ERROR}" then
        GetWinVESAIDFromRegKey="Bad Registry Info"
        exit function
    end if
    strtmpResult=right(strRegKey,len(strRegkey)-len(DISPLAY_REGKEY))
    strtmpResult=left(strtmpResult,instr(strtmpResult,"")-1)
    GetWinVESAIDFromRegKey=strtmpResult
End Function

‘————————————————–
‘GetWinPNPFromRegKey
‘————————————————–

Function GetWinPNPFromRegKey(strRegKey)

    if strRegKey="{EDID ERROR}" then
        GetWinPNPFromRegKey="Bad Registry Info"
        exit function
    end if

    strtmpResult=right(strRegKey,len(strRegkey)-len(DISPLAY_REGKEY))
    strtmpResult=right(strtmpResult,len(strtmpResult)-instr(strtmpResult,""))
    GetWinPNPFromRegKey=strtmpResult
End Function

‘————————————————–
‘GetSerialFromEDID
‘————————————————–

Function GetSerialFromEDID(strEDID)
    strTag=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hff)
    GetSerialFromEDID=GetDescriptorBlockFromEDID(strEDID,strTag)
End Function

‘————————————————–
‘GetModelFromEDID
‘————————————————–

Function GetModelFromEDID(strEDID)
    strTag=chr(&H00) & chr(&H00) & chr(&H00) & chr(&Hfc)
    GetModelFromEDID=GetDescriptorBlockFromEDID(strEDID,strTag)
End Function

‘————————————————–
‘GetDescriptorBlockFromEDID
‘————————————————–

Function GetDescriptorBlockFromEDID(strEDID,strTag)
    if strEDID="{EDID ERROR}" then
        GetDescriptorBlockFromEDID="Bad EDID"
        exit function
    end if

    dim arrDescriptorBlock(3)
    arrDescriptorBlock(0)=mid(strEDID,&H36+1,18)
    arrDescriptorBlock(1)=mid(strEDID,&H48+1,18)
    arrDescriptorBlock(2)=mid(strEDID,&H5a+1,18)
    arrDescriptorBlock(3)=mid(strEDID,&H6c+1,18)
    if instr(arrDescriptorBlock(0),strTag)>0 then
        strFoundBlock=arrDescriptorBlock(0)
    elseif instr(arrDescriptorBlock(1),strTag)>0 then
        strFoundBlock=arrDescriptorBlock(1)
    elseif instr(arrDescriptorBlock(2),strTag)>0 then
        strFoundBlock=arrDescriptorBlock(2)
    elseif instr(arrDescriptorBlock(3),strTag)>0 then
        strFoundBlock=arrDescriptorBlock(3)
    else
        GetDescriptorBlockFromEDID="Not Present in EDID"
        exit function
    end if

    strResult=right(strFoundBlock,14)

    if instr(strResult,chr(&H0a))>0 then
        strResult=trim(left(strResult,instr(strResult,chr(&H0a))-1))
    else
        strResult=trim(strResult)
    end if

    if left(strResult,1)=chr(0) then strResult=right(strResult,len(strResult)-1)
    GetDescriptorBlockFromEDID=strResult
End Function

‘————————————————–
‘GetMfgFromEDID
‘————————————————–

Function GetMfgFromEDID(strEDID)

    if strEDID="{EDID ERROR}" then
        GetMfgFromEDID="Bad EDID"
        exit function
    end if

    tmpEDIDMfg=mid(strEDID,&H08+1,2)
    Char1=0 : Char2=0 : Char3=0
    Byte1=asc(left(tmpEDIDMfg,1)) ‘get the first half of the string
    Byte2=asc(right(tmpEDIDMfg,1)) ‘get the first half of the string
    if (Byte1 and 64) > 0 then Char1=Char1+16
    if (Byte1 and 32) > 0 then Char1=Char1+8
    if (Byte1 and 16) > 0 then Char1=Char1+4
    if (Byte1 and 8) > 0 then Char1=Char1+2
    if (Byte1 and 4) > 0 then Char1=Char1+1
    if (Byte1 and 2) > 0 then Char2=Char2+16
    if (Byte1 and 1) > 0 then Char2=Char2+8

    if (Byte2 and 128) > 0 then Char2=Char2+4
    if (Byte2 and 64) > 0 then Char2=Char2+2
    if (Byte2 and 32) > 0 then Char2=Char2+1
    Char3=Char3+(Byte2 and 16)
    Char3=Char3+(Byte2 and 8)
    Char3=Char3+(Byte2 and 4)
    Char3=Char3+(Byte2 and 2)
    Char3=Char3+(Byte2 and 1)
    tmpmfg=chr(Char1+64) & chr(Char2+64) & chr(Char3+64)
    GetMfgFromEDID=tmpmfg
End Function

‘————————————————–
‘GetMfgDateFromEDID
‘————————————————–

Function GetMfgDateFromEDID(strEDID)

    if strEDID="{EDID ERROR}" then
        GetMfgDateFromEDID="Bad EDID"
        exit function
    end if

    tmpmfgweek=asc(mid(strEDID,&H10+1,1))
    tmpmfgyear=(asc(mid(strEDID,&H11+1,1)))+1990
    tmpmdt=month(dateadd("ww",tmpmfgweek,datevalue("1/1/" & tmpmfgyear))) & "/" & tmpmfgyear
    GetMfgDateFromEDID=tmpmdt
End Function

‘————————————————–
‘GetDevFromEDID
‘————————————————–

Function GetDevFromEDID(strEDID)

    if strEDID="{EDID ERROR}" then
        GetDevFromEDID="Bad EDID"
        exit function
    end if

    tmpEDIDDev1=hex(asc(mid(strEDID,&H0a+1,1)))
    tmpEDIDDev2=hex(asc(mid(strEDID,&H0b+1,1)))
    if len(tmpEDIDDev1)=1 then tmpEDIDDev1="0" & tmpEDIDDev1
    if len(tmpEDIDDev2)=1 then tmpEDIDDev2="0" & tmpEDIDDev2
    tmpdev=tmpEDIDDev2 & tmpEDIDDev1
    GetDevFromEDID=tmpdev
End Function

‘————————————————–
‘GetDevFromEDID
‘————————————————–

Function GetEDIDVerFromEDID(strEDID)

    if strEDID="{EDID ERROR}" then
        GetEDIDVerFromEDID="Bad EDID"
        exit function
    end if

    tmpEDIDMajorVer=asc(mid(strEDID,&H12+1,1))
    tmpEDIDRev=asc(mid(strEDID,&H13+1,1))
    tmpver=chr(48+tmpEDIDMajorVer) & "." & chr(48+tmpEDIDRev)
    GetEDIDVerFromEDID=tmpver
End Function

‘————————————————–
‘RegEnumKeys
‘————————————————–

Function RegEnumKeys(RegKey)
    hive=SetHive(RegKey)
    set objReg=GetWMIRegProvider()
    strKeyPath = right(RegKey,len(RegKey)-instr(RegKey,""))
    objReg.EnumKey Hive, strKeyPath, arrSubKeys
    RegEnumKeys=arrSubKeys
End Function

‘————————————————–
‘RegGetStringValue
‘————————————————–

Function RegGetStringValue(RegKey,RegValueName)
    hive=SetHive(RegKey)
    set objReg=GetWMIRegProvider()
    strKeyPath = right(RegKey,len(RegKey)-instr(RegKey,""))
    tmpreturn=objReg.GetStringValue(Hive, strKeyPath, RegValueName, RegValue)
    if tmpreturn=0 then
        RegGetStringValue=RegValue
    else
        RegGetStringValue="~{{<EDID ERROR>}}~"
    end if
End Function

‘————————————————–
‘RegGetMultiStringValue
‘————————————————–

Function RegGetMultiStringValue(RegKey,RegValueName)
    hive=SetHive(RegKey)
    set objReg=GetWMIRegProvider()
    strKeyPath = right(RegKey,len(RegKey)-instr(RegKey,""))
    tmpreturn=objReg.GetMultiStringValue(Hive, strKeyPath, RegValueName, RegValue)
    if tmpreturn=0 then
        RegGetMultiStringValue=RegValue
    else
        RegGetMultiStringValue="~{{<EDID ERROR>}}~"
    end if
End Function

‘————————————————–
‘RegGetMultiStringValue
‘————————————————–

Function RegGetBinaryValue(RegKey,RegValueName)
    hive=SetHive(RegKey)
    set objReg=GetWMIRegProvider()
    strKeyPath = right(RegKey,len(RegKey)-instr(RegKey,""))
    tmpreturn=objReg.GetBinaryValue(Hive, strKeyPath, RegValueName, RegValue)
    if tmpreturn=0 then
        RegGetBinaryValue=RegValue
    else
        RegGetBinaryValue="~{{<EDID ERROR>}}~"
    end if
End Function

‘————————————————–
‘GetWMIRegProvider
‘————————————————–

Function GetWMIRegProvider()
    strComputer = "."
    Set GetWMIRegProvider=GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "rootdefault:StdRegProv")
End Function

‘————————————————–
‘SetHive
‘————————————————–

Function SetHive(RegKey)
    HKEY_CLASSES_ROOT=&H80000000
    HKEY_CURRENT_USER=&H80000001
    HKEY_CURRENT_CONFIG=&H80000005
    HKEY_LOCAL_MACHINE=&H80000002
    HKEY_USERS=&H80000003
    strHive=left(RegKey,instr(RegKey,""))
    if strHive="HKCR" or strHive="HKR" then SetHive=HKEY_CLASSES_ROOT
    if strHive="HKCU" then SetHive=HKEY_CURRENT_USER
    if strHive="HKCC" then SetHive=HKEY_CURRENT_CONFIG
    if strHive="HKLM" then SetHive=HKEY_LOCAL_MACHINE
    if strHive="HKU" then SetHive=HKEY_USERS
End Function

‘————————————————–
‘SetHive
‘————————————————–

Sub ForceCScript
    strCurrScriptHost=lcase(right(wscript.fullname,len(wscript.fullname)-len(wscript.path)-1))
    if strCurrScriptHost<>"cscript.exe" then
        set objFSO=CreateObject("Scripting.FileSystemObject")
        Set objShell = CreateObject("WScript.Shell")
        Set objArgs = WScript.Arguments
        strExecCmdLine=wscript.path & "cscript.exe //nologo " & objfso.getfile(wscript.scriptfullname).shortpath

        For argctr = 0 to objArgs.Count – 1
            strExecArg=objArgs(argctr)
                if instr(strExecArg," ")>0 then strExecArg=chr(34) & strExecArg & chr(34)
                strExecAllArgs=strExecAllArgs & " " & strExecArg
            Next
        objShell.run strExecCmdLine & strExecAllArgs,1,false
        set objFSO = nothing
        Set objShell = nothing
        Set objArgs = nothing
        wscript.quit
    end if
End Sub

‘————————————————–
‘Pause
‘————————————————–

Sub Pause
    set objStdin=wscript.stdin
    set objStdout=wscript.stdout
    objStdout.write "Press ENTER to continue…"
    strtmp=objStdin.readline
end Sub

‘————————————————–
‘DebugOut
‘————————————————–

Sub DebugOut(strDebugInfo)

    if DEBUGMODE=0 then exit sub
    strCurrScriptHost=lcase(right(wscript.fullname,len(wscript.fullname)-len(wscript.path)-1))
    if strCurrScriptHost="cscript.exe" then wscript.echo "Debug: " & strDebugInfo
        AppendFileMode=8
        set objDebugFSO=CreateObject("Scripting.FileSystemObject")
        set objDebugStream=objDebugFSO.OpenTextFile(DEBUGFILE,AppendFileMode,True,False)
        objDebugStream.writeline strDebugInfo
        objDebugStream.Close
        set objDebugStream=Nothing
        set objDebugFSO=Nothing
End Sub

‘————————————————–
‘DumpMonitorInfoRegistry
‘————————————————–

Function DumpMonitorInfoRegistry(arrParsedMonitorInfo)
    set objReg=GetWMIRegProvider()

    for tmpctr=0 to ubound(arrParsedMonitorInfo)
        tmpResult=split(arrParsedMonitorInfo(tmpctr),"|||")
        If Instr(tmpResult(0),"EDID")<1 and Len(tmpResult(0))>1 Then
            strTempLoc = strRegDumpLoc & tmpResult(0) & ""
            objReg.CreateKey REGDUMPHIVE,strTempLoc
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_SerialNumber",tmpResult(0)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_VESAManufacturerID",tmpResult(1)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_DeviceID",tmpResult(3)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_ManufactureDate",tmpResult(2)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_ModelName",tmpResult(4)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"EDID_Version",tmpResult(5)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"Windows_VESAID",tmpResult(6)
            objReg.SetStringValue REGDUMPHIVE,strTempLoc,"Windows_PNPID",tmpResult(7)
        End If
    next

End Function

Configuration.mof

//  <:[-<>>>>>>>>>>>>>>>>>>>>>>>>>>>Start>>-MonitorInfo-<<Start<<<<<<<<<<<<<<<<<<<<<<<<<>-]:>
#pragma namespace("\\.\root\CIMV2")
#pragma deleteclass("MonitorInfo", NOFAIL)
[dynamic, provider("RegProv"),ClassContext("local|HKEY_LOCAL_MACHINE\SOFTWARE\Tools\MonitorInfo")]
class MonitorInfo

{
  [Key]                        string EDID_SerialNumber;
  [PropertyContext("EDID_DeviceID")]        string EDID_DeviceID;
  [PropertyContext("EDID_ManufactureDate")]    string EDID_ManufactureDate;
  [PropertyContext("EDID_ModelName")]        string EDID_ModelName;
  [PropertyContext("EDID_Version")]        string EDID_Version;
  [PropertyContext("EDID_VESAManufacturerID")]    string EDID_VESAManufacturerID;
  [PropertyContext("Windows_PNPID")]        string Windows_PNPID;
  [PropertyContext("Windows_VESAID")]        string Windows_VESAID;
};
//  <:[-<>>>>>>>>>>>>>>>>>>>>>>>>>>>END>>-MonitorInfo-<<END<<<<<<<<<<<<<<<<<<<<<<<<<>-]:>

sms_def.mof

//  <:[-<>>>>>>>>>>>>>>>>>>>>>>>>>>>Start>>-MonitorInfo-<<Start<<<<<<<<<<<<<<<<<<<<<<<<<>-]:>
#pragma namespace("\\.\root\cimv2\SMS")
#pragma deleteclass("MonitorInfo",NOFAIL)
[SMS_Report(TRUE), SMS_Group_Name("MonitorInfo"),SMS_Class_ID("MicroSoft|MonitorInfo|1.0")]
class MonitorInfo : SMS_Class_Template
{
  [SMS_Report(TRUE),Key]    string EDID_SerialNumber;
  [SMS_Report(TRUE)]        string EDID_DeviceID;
  [SMS_Report(TRUE)]        string EDID_ManufactureDate;
  [SMS_Report(TRUE)]        string EDID_ModelName;
  [SMS_Report(TRUE)]        string EDID_VESAManufacturerID;
  [SMS_Report(TRUE)]        string Windows_PNPID;
  [SMS_Report(TRUE)]        string Windows_VESAID;
};
//  <:[-<>>>>>>>>>>>>>>>>>>>>>>>>>>>END>>-MonitorInfo-<<END<<<<<<<<<<<<<<<<<<<<<<<<<>-]:>

Report:

SELECT DISTINCT SYS.Netbios_Name0, Resource_Domain_OR_Workgr0, SYS.AD_Site_Name0, UserName0, EDID_ModelName0 [Monitor Model], EDID_SerialNumber0 [Monitor SN], EDID_ManufactureDate0 [Monitor Manufacture Date]
from v_FullCollectionMembership r
JOIN v_GS_MONITORINFO GSM on r.ResourceID=GSM.ResourceID
JOIN V_R_System SYS on r.ResourceID=SYS.ResourceID
JOIN V_GS_COMPUTER_SYSTEM CSYS on r.ResourceID=CSYS.ResourceID
JOIN V_GS_X86_PC_Memory PCMEM on r.ResourceID=PCMEM.ResourceID
JOIN V_GS_PC_BIOS PCBIOS on r.ResourceID=PCBIOS.ResourceID
JOIN v_GS_OPERATING_SYSTEM OS on r.ResourceID=OS.ResourceID
JOIN v_GS_MD_Image_ID0 MDI on r.ResourceID=MDI.ResourceID
WHERE r.CollectionID=@CollID

Categories: SCCM Reports

SCCM Reports – Computers for a specific user name & domain

March 27, 2009 Leave a comment

In my experience I have found that the canned "Computers for a specific user name" does not work for everything if you have a mixture of domain types.  For example this helped in a situation where one division of a company used a Windows NT 4.0 domain and the other divisions were Windows 2003 or greater.  Disparate infrastructure is one of the joys of acquisitions and mergers.

The "SQL Statement" is as follows and the "Prompt" after…
 
SQL Statement
SELECT  CS.UserName0, SYS.Netbios_Name0,
        Operating_System_Name_and0, SYS.Resource_Domain_OR_Workgr0
FROM v_GS_COMPUTER_SYSTEM CS
JOIN v_R_System SYS on SYS.ResourceID = CS.ResourceID
WHERE CS.UserName0 LIKE @variable
ORDER BY CS.UserName0, SYS.Netbios_Name0
 
Prompt ("Name" = variable)
begin
 if (@__filterwildcard = ”)
  SELECT DISTINCT CS.UserName0 from v_GS_COMPUTER_SYSTEM CS Order by CS.UserName0
 else
  SELECT DISTINCT CS.UserName0 from v_GS_COMPUTER_SYSTEM CS
  WHERE CS.UserName0 like @__filterwildcard
  Order by CS.UserName0
end
 
Categories: SCCM Reports

SCCM Reports – List of All Chasis Types

March 27, 2009 Leave a comment
I found this helpful to understand the install base of certain chasis types.  You can also split this out to individual reports to isolate certain types.
 
select   Distinct sys.name0 as ‘Name’, sys.UserName0 as ‘User Name’, sys.manufacturer0 as ‘Manufacturer’, sys.model0 as ‘Model’, v_gs_pc_bios.serialnumber0,
        case enc.chassistypes0
            when 1 then ‘Other’
            when 2 then ‘Unknown’
            when 3 then ‘Desktop’
            when 4 then ‘Low Profile Desktop’
            when 5 then ‘Pizza Box’
            when 6 then ‘Mini Tower’
            when 7 then ‘Tower’
            when 8 then ‘Portable’
            when 9 then ‘Laptop’
            when 10 then ‘Notebook’
            when 11 then ‘Hand Held’
            when 12 then ‘Docking Station’
            when 13 then ‘All in One’
            when 14 then ‘Sub Notebook’
            when 15 then ‘Space-Saving’
            when 16 then ‘Lunch Box’
            when 17 then ‘Main System Chassis’
            when 18 then ‘Expansion Chassis’
            when 19 then ‘SubChassis’
            when 20 then ‘Bus Expansion Chassis’
            when 21 then ‘Peripheral Chassis’
            when 22 then ‘Storage Chassis’
            when 23 then ‘Rack Mount Chassis’
            when 24 then ‘Sealed-Case PC’
            else ‘Unknown’
        End As ‘Chassis’
from    v_gs_computer_system sys
inner join v_gs_system_enclosure enc on sys.resourceid=enc.resourceid
inner join v_gs_pc_bios on v_gs_pc_bios.resourceid=enc.resourceid
WHERE   sys.name0  LIKE @variable
order by ‘name’
Categories: SCCM Reports
%d bloggers like this: