Thursday, July 8, 2010

Getting Motherboard Model using a script

Recently I have been spending long nights helping my sister configure my desktop back in India. She is a complete novice and it has been a learning lesson for me to try and teach stuff over phone :-) I even got her to install XP after a 30 minute long conversation. As experienced users might already know when you reinstall the operating system you need to install drivers manually. She was able to install most of the required drivers except for the Soundcard. I do not remember if the soundcard was onboard or in the PCI slot. If it is onboard I assume the drivers will be in the motherboard cd. In any case I wanted to get the motherboard model number but did not know how to. One of my friends(Srujan) contacted the system administrator at Microsoft and found me the following script:

strComputer = "."
Set objWMIService = GetObject("winmgmts:"& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMB = objWMIService.ExecQuery("Select * from Win32_BaseBoard")  
For Each bbType In colMB
If  bbType.Manufacturer=("") then
MbVendor = "Unknown"
ElseIf bbType.Product=("") then
MbModel = "Unknown"
MbVendor = bbType.Manufacturer
MbModel = bbType.Product
wscript.Echo MbVendor & " " & "[" & MbModel & "]"
End If

Save this into a "motherboard.vbs" file and execute it in the command prompt with administrator privileges. Worked like a charm! Hopefully this post will help people who run into similar problem :-)

No comments: