How to get motherboard serial number in VB script

The following is a code snippet, infact the entire code, that will echo(print) the serial number of motherboard of the machine it is running on. You might as why would it be necessary for one to know the serial number. Well, if you build a software which you do not want to run on multiple machines or do not want it to be installed in multiple machines then it is very useful. For example if you have built a software that is licensed and want it to expire after a time period and want to restrict it being installed again, then you might want to check some unique attribute of the machine it is being installed into. Here you go.

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard")
For Each objItem in colItems
Wscript.Echo objItem.SerialNumber
exit for
Next

One thought on “How to get motherboard serial number in VB script

  1. Hello,
    I want to get the real serial number of mother board, hard disc. Can you please provide me a proper VB 6 code.
    Thanks,
    Chandana

Leave a comment