code:
;***** Begin Inventory
;Retrieve info by calls to WMIQuery() function
$uptime= WMIQuery("LastBootUpTime","Win32_OperatingSystem")
$wmientry=''+SubStr($uptime,5,2)+'-'+SubStr($uptime,7,2)+'-'+Left($uptime,4)+' '+SubStr($uptime,9,2)+':'+SubStr($uptime,11,2)+':'+SubStr($uptime,13,2)
? @SERROR
$SystemManufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem")
? @SERROR
$SystemModel = WMIQuery("Model","Win32_ComputerSystem")
? @SERROR
$SerialNo = "$TagID"
? @SERROR
$VideoCard = WMIQuery("Description","Win32_VideoController")
? @SERROR
$VideoRes = WMIQuery("VideoModeDescription","Win32_VideoController")
? @SERROR
$PhysicalMemory = Val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024
? @SERROR
$ProcessorSpeed = WMIQuery("CurrentClockSpeed","Win32_Processor") + " Mhz"
? @SERROR
$PagefileSpace = Val(WMIQuery("TotalPageFileSpace","Win32_LogicalMemoryConfiguration"))/1024
? @SERROR
;Enumerate all disk info into arrays, then cross-reference for required info
$arrDeviceIDs = Split(WMIQuery("DeviceID","Win32_LogicalDisk"),"|",-1)
$arrFreeSpaces = Split(WMIQuery("FreeSpace","Win32_LogicalDisk"),"|",-1)
$arrTotalSizes = Split(WMIQuery("Size","Win32_LogicalDisk"),"|",-1)
$arrFormats = Split(WMIQuery("FileSystem","Win32_LogicalDisk"),"|",-1)
For $Counter = 0 To Ubound($arrDeviceIDs)
If $arrDeviceIDs[$Counter] = "C:"
$C_DriveFormat = $arrFormats[$Counter]
$C_DriveFreeSpace = $arrFreeSpaces[$Counter]
$C_DriveTotalSize = $arrTotalSizes[$Counter]
$Counter = Ubound($arrDeviceIDs) + 1
EndIf
Next
; -- Switch the order of the Full Names
$NumCharsInFullName = Len(@FULLNAME)
$LocationOfWhiteSp = InStr(@FULLNAME," ")
$lastN = SubStr(@FULLNAME,1,($LocationOfWhiteSp - 1))
$firstN = SubStr(@FULLNAME,$LocationOfWhiteSp,($NumCharsInFullName - $LocationOfWhiteSp) + 1)
$fullName = Ltrim($firstN) + Chr(32) + Rtrim($lastN)
$CHECK_ENTRY_USERS = "SELECT * FROM TBL_USERS WHERE USERNAME='@USERID';"
$DATABASE = "\\it-fserver\temp\inventory97.mdb"
? @SERROR
$DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; UID=; PWD=; DBQ=$DATABASE"
? @SERROR
$objConn = DBConnOpen($DSN,15,15)
? @SERROR
$recordset = DBRecordsetOpen($objConn,'$CHECK_ENTRY_USERS',,'3','3')
? @SERROR
;Create new record if none exists to update
If $recordset.RecordCount < 1
$recordset.AddNew
? @SERROR
EndIf
; CODE DIES RIGHT HERE!!!!!
; ERR: Object referencing a closed or invalid connection.) [-2147352567/80020009]UserName
; Script error: unknown OR unexpected command [.Value]! $recordset.Fields("UserName").Value = @USERID
$recordset.Fields("UserName").Value = @USERID
? @SERROR
$recordset.Fields("FullName").Value = $fullName
? @SERROR
$recordset.Fields("Workstation").Value = @WKSTA
? @SERROR
$recordset.Fields("PrivilegeLevel").Value = @PRIV
? @SERROR
$recordset.Fields("LastUpdate").Value = @DATE + " " + @TIME
? @SERROR
;Update the new record and close the recordset object
$recordset.Update
$RC = DBRecordsetClose($recordset)
$RC = DBConnClose($objConn)