Jump to content

Get Bios Serial Number then write to registry


kid1519

Recommended Posts

Hello my friend i have just learned VBS therefore, i have a my homework: Get Bios Serial Number then write to registry Code:

strComputer = "."Set objWMIService = GetObject("winmgmts:" _    & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")Set colBIOS = objWMIService.ExecQuery _    ("Select * from Win32_BIOS")For each objBIOS in colBIOS    x=msgbox("Serial Number: " & objBIOS.SerialNumber)Nextconst HKEY_LOCAL_MACHINE = &H80000002strComputer = "."Set StdOut = WScript.StdOutSet oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!" &_strComputer & "rootdefault:StdRegProv")strKeyPath = "SOFTWAREGet BiosSerial Number" oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath   strValueName = "Serial Number" strValue = ???oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

Or: http://pastebin.com/PKi4FM5c

can you tell me: strValue = ??? = what do i need fill

Edited by kid1519
Link to comment
Share on other sites

If the serial number you want to save is in objBIOS.SerialNumber inside that loop, then you'll need to create an array for serial numbers that you can populate inside the loop. I'm not sure why you have a loop though, is there more than one serial number?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...