How do you search by a Serial Number and return a Computer name on a network?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anoble1
    New Member
    • Jul 2008
    • 246

    #1

    How do you search by a Serial Number and return a Computer name on a network?

    hi,

    I was wondering if their was a way to search for computers on the network by seaching by a Serial Number.
    Why? I have people calling me with a serial number and wanting to know what the PC Name is and who was on it last.

    Right now, all I can do is search by PC Name and return the serial (not the other way around)

    Any Help?

    Code:
    MyHostName = InputBox ("Enter Machine Name")
    Set objWMIService = GetObject("winmgmts:" _
                & "{impersonationLevel=impersonate}!\\" & MyHostName & "\root\cimv2")
    Set colSMBIOS = objWMIService.ExecQuery _
                ("Select * from Win32_SystemEnclosure")
      For Each objSMBIOS in colSMBIOS            
        pn = "Part Number: " & objSMBIOS.PartNumber
        sn = "Serial Number: " & objSMBIOS.SerialNumber
        sn1 =  objSMBIOS.SerialNumber
        an = "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
      Next
    
    tmp = InputBox (pn & VBCrLf & sn  & VBCrLf & an,"Computer Serial Number",sn1)
    Wondering if this code can be edited and be turned around?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can't do it the other way around because computers are located by MAC addresses and IP addresses. You will just need to run that against every computer to find out which serial it's using until you find the right one. That could take a while. It may be better to just run it every so often and have it create a directory mapping IP's to its serial number and do a lookup against that. This of course could result in some minor discrepancies.

    Comment

    Working...