Click here to return to the KiXtart HelpDesk main page...

KiXtart Script Depot

System Inventory .ini-files

; 
; ScriptNavn:  INI-file2.kix
; Lavet af:     Brian Petersen
; Dato:          24.04.2000
; Beskrivelse: System Inventory (Poor Man's SMS).
;
;                   Simple Inventory, gathering various information and stores it in an ini-file.
;                   This file can then be copied to a central location for further use.
;

Break on

; First we define the variables and gather some information...

; Date...
$MyDate=@DATE

; Time...
$MyTime=@TIME

; NetBIOS Name...
$MyName= @WKSTA

; Computer Description...
$MyComment=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP","Comment")
$MyComputer=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP","ComputerName")
$MyWorkgroup=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP","Workgroup")

; IP Address...
; Here we use LTRIM to trim blank-spaces from position x and 3 characters on...
$IP1 = LTRIM(SUBSTR(@IPADDRESS0, 1, 3))
$IP2 = LTRIM(SUBSTR(@IPADDRESS0, 5, 3))
$IP3 = LTRIM(SUBSTR(@IPADDRESS0, 9, 3))
$IP4 = LTRIM(SUBSTR(@IPADDRESS0, 13, 3))
; Then we build a valid IP address from the 4 octets, again seperated by dots...
$MyIP=$IP1 + "." + $IP2 + "." + $IP3 + "." + $IP4

; MAC Address...
$MyMAC=@ADDRESS
 
; Operating System Version...
If @INWIN = 1
   $OS="Windows NT @DOS"
endif
if @INWIN = 2
   $OS="Windows 95"
endif

; Operating System Language...
; The Macro @SYSLANG returns Operating System Language as defined in ISO Standard 639...
; Eg. 0406Danish. It may be practical to know the Language Code, eg. SMS-installation...
$OSLangCode = LTRIM(SUBSTR(@SYSLANG, 1, 4))
$OSLangName = LTRIM(SUBSTR(@SYSLANG, 5, 15))

; KiXtart Version...
$KixVer=@KIX

; Writing information to Screen...
cls
?
? "[Created]"
? "Date=" + $MyDate
? "Time=" + $MyTime
?
? "[Network]"
? "NetBIOS Name=" + $MyName
? "Description=" + $MyComment
? "IP Address=" + $MyIP
? "MAC Address=" + $MyMAC
?
? "[Windows]"
? "OS Version=" + $OS
? "Language Code=" + $OSLangCode
? "Language Name=" + $OSLangName
?
? "[KiXtart]"
? "Version=" + $KixVer
?
?

; Writing information to the ini-file...
WriteProfileString("d:\!test\inifile.ini" , "Created" , "Date" , $MyDate) 
WriteProfileString("d:\!test\inifile.ini" , "Created" , "Time" , $MyTime) 
WriteProfileString("d:\!test\inifile.ini" , "Network" , "NetBIOS Name" , $MyName) 
WriteProfileString("d:\!test\inifile.ini" , "Network" , "Description" , $MyComment) 
WriteProfileString("d:\!test\inifile.ini" , "Network" , "IP Address" , $MyIP) 
WriteProfileString("d:\!test\inifile.ini" , "Network" , "MAC Address" , $MyMAC) 
WriteProfileString("d:\!test\inifile.ini" , "Windows" , "OS Version" , $OS) 
WriteProfileString("d:\!test\inifile.ini" , "Windows" , "Language Code" , $OSLangCode) 
WriteProfileString("d:\!test\inifile.ini" , "Windows" , "Language Name" , $OSLangName) 
WriteProfileString("d:\!test\inifile.ini" , "KiXtart" , "Version" , $KixVer)