Hi
I have the following script which reads the machine name and then looks up the BIOS version on the PC, currently it only echo the results. I have a SQL server available to me, how would I connect to the server and write the results to the database? I've looked hi and low on MSDN and can't find an example of how to do this using VBscript/WSH. if someone can give me an example I'd be very grateful. Thanks, Steven
Here is the code:
'Read Machine Name
Set objComputer = CreateObject("Shell.LocalMachine")
Wscript.Echo "Computer name: " & objComputer.MachineName
'Read BIOS details
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
For each objBIOS in colBIOS
Wscript.Echo objBIOS.Manufacturer
Wscript.Echo objBIOS.Name
Wscript.Echo objBIOS.SerialNumber
Next
I have the following script which reads the machine name and then looks up the BIOS version on the PC, currently it only echo the results. I have a SQL server available to me, how would I connect to the server and write the results to the database? I've looked hi and low on MSDN and can't find an example of how to do this using VBscript/WSH. if someone can give me an example I'd be very grateful. Thanks, Steven
Here is the code:
'Read Machine Name
Set objComputer = CreateObject("Shell.LocalMachine")
Wscript.Echo "Computer name: " & objComputer.MachineName
'Read BIOS details
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")
For each objBIOS in colBIOS
Wscript.Echo objBIOS.Manufacturer
Wscript.Echo objBIOS.Name
Wscript.Echo objBIOS.SerialNumber
Next