'---------------------------------------------------------------------------------------
' Procedure : ProcessorID
' DateTime  : 5/7/2009
' Author    : Patrick Wood - Gaining Access Technologies http://gainingaccess.net/
' Purpose   : Get the Computer ProcessorID from the Win32_Processor WMI Class
'---------------------------------------------------------------------------------------
'
Function ProcessorID() As String

    'Using late binding to avoid a Reference problem
    Dim strComputer As String
    Dim objWMIService As Object
    Dim colItems As Object
    Dim objItem As Object

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")

    Set colItems = objWMIService.ExecQuery( _
        "SELECT * FROM Win32_Processor", , 48)

    For Each objItem In colItems
        ProcessorID = Nz(objItem.ProcessorID, 0)
    Next

    Set objItem = Nothing
    Set colItems = Nothing
    Set objWMIService = Nothing

End Function