Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Get Bios Serial Number then write to registry

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

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
    ("Select * from Win32_BIOS")
For each objBIOS in colBIOS
    x=msgbox("Serial Number: " & objBIOS.SerialNumber)
Next


const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Get Bios\Serial 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

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>