Jump to content
Sign in to follow this  
kid1519

Get Bios Serial Number then write to registry

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...