I am trying to use this script above to capture data and dump it to an SQL database. I have the SQL database created with the necessary table and fields.
I will post my code below but I wanted to inform that the only data that is being displayed or captured is this:
FullName, PCName, UserName, Comment, LastLogin, Language (looks funky though), IP, & MACAddress. It misses the rest. Can anyone help? I have a couple of things commented out because I am no longer using them. However the Dell Service Tag code if i use that then i can capture that SysSerial info.

Code:
 

;Call @LSERVER+ "\NETLOGON\GetUserOU.udf"

CLS
At (1,1) "Obtaining Computer Information..."
Sleep 2
CLS
Break On CLS

;**** Declare Variables ****
Dim $cnstring, $cmdtxt, $cn, $cmd, $rs, $modifydatetime, $username, $osname, $pcmodel, $comment, $language,
$servicepack, $sysmanufacturer, $sysserial, $ipaddress, $maccaddr

;**** Configure Database Connection String ****
$CNstring = "DRIVER={SQL Server};SERVER=Sussex-SQL;UID=warranty;PWD=warranty;DATABASE=Warranty"
$CMDtxt = "select * from COMPUTERS where PCName = '@WKSTA'"
$cn = CreateObject ("ADODB.Connection")
$cmd = CreateObject ("ADODB.Command")
$rs = CreateObject ("ADODB.RecordSet")
$cn.connectionstring = $CNstring
$cn.Open
$cmd.activeconnection = $cn
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd

$cmd.commandtext = $CMDtxt $rs.Open ($cmd)

;**** Collect Workswtation Asset Information ****
$ModifyDateTime = @DATE + " " + @TIME
$pcname = @WKSTA
$username = @USERID
$comment = @COMMENT
$ipaddress = @IPADDRESS0
$osname = WMIQuery("Caption", "Win32_OperatingSystem")
$language = @SYSLANG
$macaddr = @ADDRESS
$servicepack = WMIQuery("CSDVersion", "Win32_OperatingSystem")
$sysmanufacturer = WMIQuery("Manufacturer", "Win32_ComputerSystem")
$pcmodel = WMIQuery("Model", "Win32_ComputerSystem")
$sysserial = WMIQuery("SerialNumber", "Win32_BIOS")

; **** Compatibility with AD migration checking ****
If $lanaddr="0.0.0.0"
$lanaddr="unknown"
$macaddr="unknown"
EndIf

Function WMIQuery($what,$where,)
Dim $strquery, $objenumerator, $value
$strquery = "Select $what From $where"
$systemset = GetObject("winmgmts:{impersonationLevel:impersonate}!//"+@WKSTA)
$objenumerator = $systemset.execquery($strquery)
For Each $objinstance IN $objenumerator
IF @error = 0 AND $objinstance <> ""
$=Execute("$$value = $$objinstance.$what")
$wmiquery="$value"+"|"+"$WMIQuery"
EndIF
Next
$wmiquery=Left($wmiquery,Len($wmiquery)-1)
Exit @ERROR
EndFunction

;**** Add Records to the database ****

If $rs.eof = -1 ; Addnew is only needed if a record for this workstation was not found.
$rs.addnew
EndIf

$rs.fields.item("PCName").value = $pcname
$rs.fields.item("UserName").value = $username
$rs.fields.item("Comment").value = $comment
$rs.fields.item("LastLogin").value = $modifydatetime
$rs.fields.item("OSName").value = $osname
$rs.fields.item("Language").value = $language
$rs.fields.item("ServicePack").value = $servicepack
$rs.fields.item("PCManufacturer").value = $sysmanufacturer
$rs.fields.item("PCModel").value = $pcmodel
$rs.fields.item("SysSerial").value = $sysserial
$rs.fields.item("IP").value = $ipaddress
$rs.fields.item("MACAddress").value = $macaddr
$rs.update
$rs.Close

;**********************
; Dell Service Tag Code
;**********************
;$objs = GetObject("WinMgmts:").InstancesOf("Win32_SystemEnclosure")
;For Each $obj In $objs
; $ServiceTag = $obj.SerialNumber
;Next
;$SMS_ID=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\configuration\Client Properties\","SMS Unique Identifier")

Sleep 5