Page 1 of 1 1
Topic Options
#154335 - 2005-12-30 10:44 PM Inventory Script.... Kixforms Edition
Gn0stik Offline
Fresh Scripter

Registered: 2005-12-27
Posts: 12
I just want to thank everyone again for their help on my inventory, script. I thought I'd post my latest update here. It's kixforms based. So without furthur adieu...

Code:
; *************Network Inventory Script By Rich Weber ****************
; * This script acquires data about the local user and computer
; * via WMI and outputs the information to a centrally located
; * MS Access or MS SQL database. Other Database engines are configurable
; * as well by changing the connection string variable $CNstring
; * all code is recyclable and free to use as you wish, and distribute,
; * as much of it was borrowed from other sources during my research of this
; * project. I just ask that if it's modified that you email me a copy
; * of your modifications, as I'd like to see any improvements, or progress
; * made on the script. Mostly for learning purposes.
; * Best Regards, Rich rich.weber@gmail.com

; ***********************Database Configuration***********************
; *The database consist of 5 Tables; Computers, Printers, Disks, Software,
; *and services. Following are the fields that make up each:

; *Computers: COMPUTERNAME, USERNAME, DOMAIN, MODIFYDATETIME, SYSNAME, OSNAME
; MANUFACTURER, OSVERSIONOSBUILD, OSTYPE, LANGUAGE, SERVICEPACK, BOOTDEVICE
; SYSTEMDEVICE, WINDIRSYSDIR, OSSERIAL, SYSMANUFACTURER, SYSMODEL, SYSBIOSDATE
; SYSMEMORY, VIDEOCARD, VIDEORES
; *CPUs: CPUMANUFACTURER, CPUDESCRIPTION, CPUSPEED, MAXCLOCK, FAMILY, STEPPING, DEVICEID
; *Disks: COMPUTERNAME, DISKNAME, VOLUME, FILESYS, DISKSIZE, FREESPACE
; *Services: COMPUTERNAME, SERVICE, DESCRIPTION, PATH, STATE
; *Software: COMPUTERNAME, APPLICATION, DESCRIPTION, VERSION, VENDOR
; *Printers: COMPUTERNAME, PRINTER, DESCRIPTION, DRIVER
; *Netconfig: COMPUTERNAME, NICCID, IPADDRESS, IPSUBNET, MACADDRESS, SERVICENAME, DESCRIPTION

; * You may have to play with field sizes to display information properly.

; **If anyone cares to create a script for automating the database creation
; **for Access, or SQL server that would be great, if you do, shoot me an
; **email.

$=setoption("wrapateol","on")
Dim $DBpath, $DBFile

$DBpath = @scriptdir ;Modify this to represent your database location if using an access database.
$DBfile = $DBpath +"\ITAssets.mdb"

Break ON
CLS

If Exist($DBpath) = 0 ;Abort if no Database exists when using an access database.
? "IT Assets Database Not Found. Aborting..."
Sleep 3
Exit 1
Else
InvMain($DBFile)
$Infolabel.text = "Thank you for your" + @CRLF + "Patience " + @USERID + @CRLF+ "Have a nice day."
sleep 2
Exit 1
EndIf

Function InvMain($DBFile)
Dim $CNstring, $CMDtxt, $cn, $cmd, $rs

;*** CONFIGURE DATABASE CONNECTION STRING ***
$CNstring="Driver={Microsoft Access Driver (*.mdb)}; DBQ=$DBFile" ;Next line for sql server
;$CNstring = "Driver={SQL Server};Server=MyServer;database=MyDatabase;uid=UserName;pwd=password"

$CMDtxt = "select * from COMPUTERS where computername = '@WKSTA'"
$cn = CreateObject ("ADODB.Connection")
$cmd = CreateObject ("ADODB.Command")
$rs = CreateObject ("ADODB.RecordSet")

$cn.connectionstring = $CNstring
$cn.Open
$cmd.activeconnection = $cn

DrawInvForm()
QueryLogon($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
QueryHardware($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
QueryCPU($cn, $cmd, $rs, $CNstring, $DBfile)
QueryNetConfig($cn, $cmd, $CNstring, $rs, $DBfile)
QueryDisks($cn, $cmd, $rs, $CNstring, $DBfile)
QueryPrinters($cn, $cmd, $CNstring, $rs, $DBfile)
QueryOS($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
QuerySoftware($cn, $cmd, $CNstring, $rs, $DBfile)
QueryServices($cn, $cmd, $CNstring, $rs, $DBfile)
$cn.close
EndFunction

; Draw Forms for display of progress.
Function DrawInvForm()
$System = CreateObject("Kixtart.System")

; Form
$Form = $System.Form()
$Form.Text = "Updating Inventory..."
$Form.Width = 260
$Form.Height = 320
If $DebugFlag=$True
$Form.Left=(1024 / 2) - (500 / 2)
$Form.Top=(768 / 2) - (400 /2 )
Else
$Form.Center
EndIf

; Logo
$Logo=$Form.PictureBox
$Logo.borderstyle = 1
$Logo.Left=5
$Logo.Top=5
$Logo.Width=99
$Logo.Height=45
$Logo.Picture="logosm.bmp"

;Info Label
$Infolabel= $Form.label
$Infolabel.text = "Scanning your computer:" + @CRLF + @CRLF +" " + @WKSTA
$Infolabel.borderstyle = 0
$Infolabel.Left=111
$Infolabel.Top=6
$Infolabel.Width=136
$Infolabel.Height=45
$Infolabel.Enable=0
$Infolabel.BackColor = $form.backcolor

; Action Frame
$ActionFrame = $Form.Frame("Actions",5,52,240,155)
$ActionFrame.Borderstyle = 1
$Logoncheckbox = $ActionFrame.checkbox("Logon Info", 5, 15, 230, 15)
$Logoncheckbox.checked = false
$Logoncheckbox.flatstyle = 0
$Hardwarecheckbox = $ActionFrame.checkbox("Base Configuration", 5, 30, 230, 15)
$Hardwarecheckbox.checked = false
$Hardwarecheckbox.flatstyle = 0
$CPUcheckbox = $ActionFrame.checkbox("CPU/s", 5, 45, 230, 15)
$CPUcheckbox.checked = false
$CPUcheckbox.flatstyle = 0
$NetConfigcheckbox = $ActionFrame.checkbox("Network Configuration", 5, 60, 230, 15)
$NetConfigcheckbox.checked = false
$NetConfigcheckbox.flatstyle = 0
$Diskscheckbox = $ActionFrame.checkbox("Disk Configuration", 5, 75, 230, 15)
$Diskscheckbox.checked = false
$Diskscheckbox.flatstyle = 0
$Printerscheckbox = $ActionFrame.checkbox("Printers", 5, 90, 230, 15)
$Printerscheckbox.checked = false
$Printerscheckbox.flatstyle = 0
$OScheckbox = $ActionFrame.checkbox("Operating System", 5, 105, 230, 15)
$OScheckbox.checked = false
$OScheckbox.flatstyle = 0
$Softwarecheckbox = $ActionFrame.checkbox("Installed Software", 5, 120, 230, 15)
$Softwarecheckbox.checked = false
$Softwarecheckbox.flatstyle = 0
$Servicescheckbox = $ActionFrame.checkbox("Services", 5, 135, 230, 15)
$Servicescheckbox.checked = false
$Servicescheckbox.flatstyle = 0

; Progress Bar
$ProgressTextBox= $Form.textbox
$ProgressTextBox.borderstyle = 1
$ProgressTextBox.Left=5
$ProgressTextBox.Top=215
$ProgressTextBox.Width=240
$ProgressTextBox.Height=20
$ProgressTextBox.Enable=0
$ProgressTextBox.BackColor = $form.backcolor

$ProgressBar = $Form.ProgressBar
$Progressbar.borderstyle = 1
$ProgressBar.Left=5
$ProgressBar.Top=240
$ProgressBar.Width=240
$ProgressBar.Height=20
$ProgressBar.Style = 0
$Form.Show

EndFunction

; Updates the progress bar
Function InvProgress($ProgressText,optional $Step) ;Progress bar updating
If $Step=""
$Step=$progressstep
EndIf
$ProgressTextBox.Text=$ProgressText
If $ProgressBar.Value + $Step < 101
$ProgressBar.Value=$ProgressBar.Value+$Step
If $DebugFlag = $TRUE
Sleep $sleeptime
EndIf
Else
$ProgressBar.Value=100
EndIf
EndFunction

;Queries Logon information, updates COMPUTERS table.
Function QueryLogon($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
Dim $CMDtxt, $ComputerName, $ModifyDateTime, $username, $domain
InvProgress("Querying Logon Information", val(100/9))
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt $rs.Open ($cmd)
$ComputerName = @WKSTA
$username = @userid
$domain = @domain
$ModifyDateTime = @DATE + " " + @TIME
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("MODIFYDATETIME").value = $ModifyDateTime
$rs.fields.item("COMPUTERNAME").value = $computername
$rs.fields.item("DOMAIN").value = $domain
$rs.fields.item("USERNAME").value = $Username
$rs.update
$rs.Close
$Logoncheckbox.checked = true
EndFunction

;Queries Hardware, updates COMPUTERS table.
Function QueryHardware($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
Dim $SysManufacturer, $SysModel, $SysSerial, $SystemBIOSVer, $SysBIOSDate
Dim $SysMemory, $VideoCard, $VideoRes, $Modem, $Printers
InvProgress("Querying Hardware",val(100/9))
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$SysManufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem")
$SysModel = WMIQuery("Model","Win32_ComputerSystem")
$SysSerial = WMIQuery("SerialNumber","Win32_BIOS")
$SystemBIOSVer = WMIQuery("SMBIOSBIOSVersion","Win32_BIOS")
$SysBIOSDate = WMIQuery("Version","Win32_BIOS")
$SysMemory = Val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024+1
$VideoCard = WMIQuery("Description","Win32_VideoController")
$VideoRes = WMIQuery("VideoModeDescription","Win32_VideoController")
$Modem = WMIQuery("Description","Win32_POTSModem")
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("SYSMANUFACTURER").value = $SysManufacturer
$rs.fields.item("SYSMODEL").value = $SysModel
$rs.fields.item("SYSBIOSVER").value = $SystemBIOSVer
$rs.fields.item("SYSBIOSDATE").value = $SysBIOSDate
$rs.fields.item("SYSMEMORY").value = $SysMemory
$rs.fields.item("VIDEOCARD").value = $VideoCard
$rs.fields.item("VIDEORES").value = $VideoRes
$rs.Update
$rs.Close
$Hardwarecheckbox.checked = true
EndFunction

;Gathers info about installed CPUs, updates COMPUTERS Table
;currently only single cpu supported, but easy to break out to multiple in for each.
Function QueryCPU($cn, $cmd, $rs, $CNstring, $DBfile)
Dim $CPUManufacturer, $CPUDescription, $CPUSpeed, $CMDtxt, $Item, $CPUs, $wmiRoot
Dim $DeviceID, $CMDtxt, $MaxClock, $Family, $Stepping
$CMDtxt = "select * from CPUS where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$wmiRoot = GetObject("WinMgmts:root/cimv2")
InvProgress("Querying Processors",val(100/9))
$CPUs = $wmiRoot.ExecQuery("Select * FROM Win32_Processor")
For Each $Item in $CPUs
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("CPUMANUFACTURER").value = $Item.Manufacturer
$rs.fields.item("CPUDESCRIPTION").value = $Item.Description
$rs.fields.item("CPUSPEED").value = $Item.CurrentClockSpeed
$rs.fields.item("MAXCLOCK").value = $Item.MaxClockSpeed
$rs.fields.item("FAMILY").value = $Item.Family
$rs.fields.item("STEPPING").value = $Item.Stepping
$rs.fields.item("DEVICEID").value = $Item.DeviceID
$rs.Movenext
Next
$rs.update
$rs.close
$CPUcheckbox.checked = true
EndFunction

;Queries Network Adapters and gathers network configuration, updates NETCONFIG table.
Function QueryNetconfig($cn, $cmd, $CNstring, $rs, $DBfile)
DIM $CMDtxt, $wmiRoot, $IP, $item, $Ivalue, $i
$CMDtxt = "select * from NETCONFIG where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open($cmd)
$ncount = 0
InvProgress("Querying Network Adapters",val(100/9))
$wmiRoot = GetObject("WinMgmts:root/cimv2")
$IP = $wmiRoot.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = true")
For Each $item In $IP
For $i = 0 to Ubound($item.IPAddress)
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("NICID").value = $i
$rs.fields.item("IPADDRESS").value = $item.IPAddress($i)
$rs.fields.item("SUBNETMASK").value = $item.IPsubnet($i)
$rs.fields.item("MACADDRESS").value = $item.MACAddress
$rs.fields.item("SERVICENAME").Value = $item.ServiceName
$rs.fields.item("DESCRIPTION").value = Trim(Substr($item.caption, 11, Len($item.caption)-10))
$rs.MoveNext
$ncount=$ncount + 1
Next
Next
$rs.Update
$CMDtxt = "select * from COMPUTERS where computername = '@WKSTA'"
$rs.fields.item("NICCOUNT").value = $ncount
$rs.update
$rs.Close
$NetConfigcheckbox.checked = true
EndFunction

;Gathers information about Logical Disks, updates DISKS table.
Function QueryDisks($cn, $cmd, $rs, $CNstring, $DBfile)
Dim $CMDtxt, $Item, $Disks, $Drivetype, $Diskspace, $GBDiskspace, $Freespace, $GBFreespace
$CMDtxt = "select * from DISKS where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$wmiRoot = GetObject("WinMgmts:root/cimv2")
InvProgress("Querying Disk Drives",val(100/9))
$Disks = $wmiRoot.ExecQuery("Select * FROM Win32_LogicalDisk WHERE DriveType=3")
For Each $Item in $Disks
$Disksize=0.0
$Freespace=0.0
$Disksize = $Disksize + $Item.size
$Freespace = $Freespace + $Item.freespace
$GBDisksize = Round(($Disksize / 1073741824),2)
$GBFreespace = Round(($Freespace / 1073741824),2)
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("DISKNAME").value = $Item.Name
$rs.fields.item("VOLNAME").value = $Item.VolumeName
$rs.fields.item("DISKSIZE").value = $GBDisksize
$rs.fields.item("FILESYS").value = $Item.Filesystem
$rs.fields.item("FREESPACE").value = $GBFreespace
$rs.Movenext
Next
$rs.Update
$rs.Close
$Diskscheckbox.checked = true
EndFunction


;Gathers information about printers, updates PRINTERS Table.
Function QueryPrinters($cn, $cmd, $CNstring, $rs, $DBfile)
Dim $CMDtxt, $wmiRoot, $Printers, $Item
$CMDtxt = "select * from PRINTERS where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$wmiRoot = GetObject("WinMgmts:root/cimv2")
?InvProgress("Querying Printers",val(100/9))
$Printers = $wmiRoot.ExecQuery("Select * FROM Win32_Printer")
For Each $Item in $Printers
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("PRINTER").value = $Item.Caption
$rs.fields.item("DESCRIPTION").value = $Item.Description
$rs.fields.item("DRIVER").value = $Item.DriverName
$rs.MoveNext
Next
$rs.Update
$rs.Close
$Printerscheckbox.checked = true
EndFunction

;Queries OS via WMI, updates COMPUTERS table.
Function QueryOS($cn, $cmd, $rs, $CNstring, $CMDtxt, $DBfile)
Dim $OSSerial, $sysname, $osname, $SysDir, $Manufacturer
Dim $OSVersion, $OSBuild, $OSType, $Language, $ServicePack
Dim $BootDevice, $SystemDevice, $WinDir
InvProgress("Querying OS",val(100/9))
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$sysname = WMIQuery("CSName","Win32_OperatingSystem")
$osname = WMIQuery("Caption","Win32_OperatingSystem")
$Manufacturer = WMIQuery("Manufacturer","Win32_OperatingSystem")
$OSVersion = WMIQuery("Version","Win32_OperatingSystem")
$OSBuild = WMIQuery("BuildNumber","Win32_OperatingSystem")
$OSType = WMIQuery("BuildType","Win32_OperatingSystem")
$Language = WMIQuery("OSLanguage","Win32_OperatingSystem")
$ServicePack = WMIQuery("CSDVersion","Win32_OperatingSystem")
$BootDevice = WMIQuery("BootDevice","Win32_OperatingSystem")
$SystemDevice = WMIQuery("SystemDevice","Win32_OperatingSystem")
$WinDir = WMIQuery("WindowsDirectory","Win32_OperatingSystem")
$SysDir = WMIQuery("SystemDirectory","Win32_OperatingSystem")
$OSSerial = WMIQuery("SerialNumber","Win32_OperatingSystem")
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("SYSNAME").value = $Sysname
$rs.fields.item("OSNAME").value = $osname
$rs.fields.item("MANUFACTURER").value = $Manufacturer
$rs.fields.item("OSVERSION").value = $OSVersion
$rs.fields.item("OSBUILD").value = $OSBuild
$rs.fields.item("OSTYPE").value = $OSType
$rs.fields.item("LANGUAGE").value = $Language
$rs.fields.item("SERVICEPACK").value = $ServicePack
$rs.fields.item("BOOTDEVICE").value = $BootDevice
$rs.fields.item("SYSTEMDEVICE").value = $SystemDevice
$rs.fields.item("WINDIR").value = $WinDir
$rs.fields.item("SYSDIR").value = $SysDir
$rs.fields.item("OSSERIAL").value = $OSSerial
$rs.update
$rs.Close
$OScheckbox.checked = true
EndFunction

;Pulls information about installed software from the Registry, updates SOFTWARE table.
Function QuerySoftware($cn, $cmd, $CNstring, $rs, $DBfile)
Dim $CMDtxt, $Index, $KeyName, $Application, $Version, $Publisher
$CMDtxt = "select * from SOFTWARE where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
InvProgress("Querying Installed Software",val(100/9))

$Index = 0
$KeyName = EnumKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall", $Index)
$Application = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "DisplayName")
$Version = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "DisplayVersion")
$Vendor = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "Publisher")

While Len($keyname) > 0
If Len($Application)> 0
If $rs.eof = -1
$rs.addnew
EndIf
$rs.fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("APPLICATION").value = $Keyname
$rs.fields.item("VERSION").value = $Version
$rs.fields.item("VENDOR").value = $Vendor
$rs.fields.item("DESCRIPTION").value = $Application
$rs.MoveNext
EndIf

$Index = $Index + 1
$KeyName = EnumKey("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall", $Index)
$Application = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "DisplayName")
$Version = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "DisplayVersion")
$Vendor = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\$KeyName", "Publisher")
Loop
$rs.update
$rs.Close
$Softwarecheckbox.checked = true
EndFunction

;Queries WMI for services and their properties, updates SERVICES table.
Function QueryServices($cn, $cmd, $CNstring, $rs, $DBfile)
Dim $CMDtxt, $Services, $Item, $wmiRoot
$CMDtxt = "select * from SERVICES where computername = '@WKSTA'"
$rs.cursortype = 3
$rs.locktype = 3
$rs.activecommand = $cmd
$cmd.commandtext = $CMDtxt
$rs.Open ($cmd)
$wmiRoot = GetObject("WinMgmts:root/cimv2")
InvProgress("Querying Services",val(100/9))
$Services = $wmiRoot.ExecQuery("Select * FROM Win32_Service")
For Each $Item in $Services
If $rs.eof = -1
$rs.addnew
EndIf
$rs.Fields.item("COMPUTERNAME").value = @WKSTA
$rs.fields.item("SERVICE").value = $Item.Name
$rs.fields.item("DESCRIPTION").value = $Item.Description
$rs.fields.item("PATH").value = $Item.PathName
$rs.fields.item("STARTMODE").value = $Item.Startmode
$rs.fields.item("STATE").value = $Item.State
$rs.MoveNext
Next
$rs.Update
$rs.Close
$Servicescheckbox.checked = true
EndFunction

;Used for gathering Info from WMI, Just pass it the Item and Object
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



Top
#154336 - 2005-12-30 11:07 PM Re: Inventory Script.... Kixforms Edition
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Thanks for sharing.
FYI, the newer KiX supports block comments. Beats having all those semicolons.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#154337 - 2006-01-05 06:29 PM Re: Inventory Script.... Kixforms Edition
Aaron Perrault Offline
Fresh Scripter

Registered: 2003-08-29
Posts: 27
Loc: Emeryville, CA
Hey there,
this looks like a great script. One question i have, what are you using for the primary key in each table of the database?

thanks

app

Top
#154338 - 2006-01-11 12:05 AM Re: Inventory Script.... Kixforms Edition
Gn0stik Offline
Fresh Scripter

Registered: 2005-12-27
Posts: 12
only one pk in the whole deal, only one was necessary, COMPUTERNAME in the the COMPUTERS table. I've also written a database viewer in C# on the .net 2.0 framework if anyone's interested.
Top
#154339 - 2006-01-17 10:31 AM Re: Inventory Script.... Kixforms Edition
andreasfc Offline
Fresh Scripter

Registered: 2001-12-13
Posts: 18
This looks very good, but it is giving me an error.
ERROR : expected ')'!
Script: <Pathname>\ItAssets.kix
Line : 120
This section:
; Action Frame
$ActionFrame = $Form.Frame("Actions",5,52,240,155)
And I am interested in the database viewer.
Which version of MsAccess do I need to use?
Can you post an example file?
UPDATE: Found the problem, kixforms.dll not present.
There are also a few minor scripterrors.
Missing: COMPUTERNAME, table CPUs
NICID = NICCID
IPSUBNET=IPSUBNETMASK
Thanx


Edited by andreasfc (2006-01-17 01:45 PM)

Top
#154340 - 2006-05-02 04:37 AM Re: Inventory Script.... Kixforms Edition
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
I may be missing something very obvious here, but is there an empty database template we can use with this (having an extremely limited knowledge of databases).

Thanks

Top
#154341 - 2006-05-03 03:42 AM Re: Inventory Script.... Kixforms Edition
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
OK, managed to get some help with Access dbase. Next question, do the people running it need to have Access installed? It runs fine on my machine but not on another. User gets an error about no ( in line 145

Line 145: $ActionFrame = $Form.Frame("Actions",5,52,240,155)

Reading above it looks like someone else had a similar error and it was related to kixforms.dll. I have this on both PC's (in system32 folder). Should it be registered?

UPDATE:
You need to register the DLL then all OK.
Nice script that does what it says it will. Maybe I'll learn a bit more about Access so we can use it in a little more detail.


Edited by Mark Bennett (2006-05-03 04:40 AM)

Top
#154342 - 2006-05-03 04:34 AM Re: Inventory Script.... Kixforms Edition
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Should kixforms.dll be registered ? Absolutely ... like this:

c:\> regsvr32 c:\windows\system32\kixforms.dll

-Shawn

Top
#154343 - 2006-05-03 04:41 AM Re: Inventory Script.... Kixforms Edition
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
Thanks Shawn
Top
#154344 - 2006-05-03 04:56 AM Re: Inventory Script.... Kixforms Edition
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hmmm, I have never seen this script before - cool. If your using the latest version of Kixforms though, you will want to replace all occurences of "Frame" with "GroupBox" ... I just did a global find/replace ... all is good.

-Shawn

Top
#154345 - 2006-05-04 04:41 AM Re: Inventory Script.... Kixforms Edition
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
The computers need to have the appropriate database driver installed, e.g. a recent version of MDAC. Then you can, preferably, use a DNS-less connection to the backend database.
_________________________
There are two types of vessels, submarines and targets.

Top
#154346 - 2006-05-24 03:01 PM Re: Inventory Script.... Kixforms Edition
scott_s Offline
Fresh Scripter

Registered: 2004-06-15
Posts: 15
Great script, I had a problem getting Serial number from the WMI Baseboard so I added this with a little debugging to see what Serial number you grab.
I will be posting a SQL script to Create the DB soon.
I added a few Fields, Monitor, Serial number was not being written out to the DB also...

If $SysSerial = ""
$Sysserial = WMIQuery("SerialNumber","Win32_BIOS")
InvProgress("Serial Num2: $SysSerial",Val(100/9))
Sleep 1
Else
InvProgress("Serial Num1: $SysSerial",Val(100/9))
Sleep 1
EndIf

Top
#154347 - 2006-05-24 03:08 PM Re: Inventory Script.... Kixforms Edition
scott_s Offline
Fresh Scripter

Registered: 2004-06-15
Posts: 15
I also see this being modified a little to Track Logins to the network.
So if there was a sub table for UserID workstation, Date and time you would have a full log of who logged in where and when.

Top
#154348 - 2006-05-24 10:44 PM Re: Inventory Script.... Kixforms Edition
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Please don't forget support for the following when a final solution is posted.

SetOption('Explicit','On')
SetOption('NoVarsInStrings','On')
SetOption('NoMacrosInStrings','On')

Top
#154349 - 2006-07-03 10:17 PM Re: Inventory Script.... Kixforms Edition
nazgul Offline
Fresh Scripter

Registered: 2006-01-21
Posts: 11
Does anyone have a viewer for the mysql version?
Top
#154350 - 2006-07-19 08:05 PM Re: Inventory Script.... Kixforms Edition
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Code:

If Exist($DBpath) = 0 ;Abort if no Database exists when using an access database.
? "IT Assets Database Not Found. Aborting..."
Sleep 3


if it's kf script, why the error on console?

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 927 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.068 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org