Here follows the code for this nead Inventory Script.
External programes needed are:
The only problem is that every OS, even subversions (a,b,c), have their own sort file!!!
Just ask me to E-mail them, or maybe someone can place them on the board... (previous posting)
The script requires that all the sort.exe files are renamed to:
Sort95a.exe / Sort95.exe / SortNT.exe / Sort2k.exe (check script).
code:
;*******************************************************************************
;** Script: Blokker B.V. Inventory script
;** Version: 1.18c
;** Created: June 2, 2001
;**
;** E-mail: slminc90@hotmail.com
;**
;** Works for NT & W9x
;** Rename Sort.exe from all OS: W95a/W95b/W98/NT4/W2k
;** - Sort95a.exe / Sort95b / Sort98 / SortNT.exe / SortW2k
;**
;**
;** Modifications:
;** - Jun/02/01 - Designed the global structure
;** - Jun/05/01 - Added Standard KIX Macro's
;** - Jun/07/01 - Added Installed software
;** - Jun/12/01 - Added Persistant drive mappings
;** - Jun/13/01 - Added Network and local printers
;** - Jun/13/01 - Added OS Information
;** - Jun/17/01 - Added McAfee information
;** - Jun/19/01 - Added Office detection
;** - Jun/20/01 - Added Run once every 7 days
;** - Jun/21/01 - Added Sort option of installed software
;** - Jun/24/01 - Added Copy files to central directory and create own stucture
;** - Jun/25/01 - Added CPU Information
;** - Jun/29/01 - Added Memory Information
;**
;** - xxx/xx/xx - Add new entries here!
;**
;*******************************************************************************
;*******************************************************************************
BREAK OFF CLS
;IF @WKSTA=("Ams000020")
;GOTO MAIN
;ENDIF
$HKLM = "HKEY_LOCAL_MACHINE\"
$KixSubKey = $HKLM + "SOFTWARE\KiXtart"
$ScriptKey = "\" + "DateCheck"
If Existkey ("$KixSubKey$ScriptKey") <> 0
$key = Addkey ("$KixSubKey$ScriptKey") ; Add the key if not exist
Goto KeyEntry
ENDIF
$LastRun = READVALUE("$KixSubKey$ScriptKey","LastRunDate")
SELECT
CASE @YDAYNO - $LastRun > 7
GOTO "KeyEntry" ; More than 7 days ago
CASE 1
Color r+/n AT ( 4, 4) "N"
Color w+/n AT ( 4, 5) "o"
Color r+/n AT ( 4, 7) "N"
Color w+/n AT ( 4, 8) "e"
Color w+/n AT ( 4, 9) "e"
Color r+/n AT ( 4,10) "d"
Color r+/n AT ( 4,12) "T"
Color w+/n AT ( 4,13) "o"
Color r+/n AT ( 4,15) "R"
Color w+/n AT ( 4,16) "u"
Color r+/n AT ( 4,17) "n"
Color r+/n AT ( 4,19) "A"
Color w+/n AT ( 4,20) "n"
Color r+/n AT ( 4,22) "I"
Color w+/n AT ( 4,23) "n"
Color r+/n AT ( 4,24) "v"
Color w+/n AT ( 4,25) "e"
Color r+/n AT ( 4,26) "n"
Color w+/n AT ( 4,27) "t"
Color r+/n AT ( 4,28) "o"
Color w+/n AT ( 4,29) "r"
Color r+/n AT ( 4,30) "y"
Color w+/n AT ( 4,32) "!"
Sleep 2
; $return = DELKEY ("$KixSubKey$ScriptKey" ; Use this to reset clients
GOTO "END"
ENDSELECT
;******************************************************************************
;** KeyEntry when was last run Inventory Script
;******************************************************************************
:KeyEntry
$return = WRITEVALUE("$KixSubKey$ScriptKey","LastRunDate","@YDAYNO","REG_SZ")
DEL ("C:\KIX32\@WKSTA\*.doc") ; Delete Inventory documents, leave only the newest on local machine
;******************************************************************************
;** Main script starts here
;******************************************************************************
:MAIN
; ******************************************************************************
; Cleanup old situation
; ******************************************************************************
IF EXIST ("C:\KIX32\kbd*.kbd") = 1
COPY ("C:\KIX32\kbd*.kbd") ("C:\KIX32\BACKUP\")
DEL ("C:\KIX32\kbd*.kbd")
ENDIF
IF EXIST ("C:\KIX32\msnet32.old") = 1
COPY ("C:\KIX32\msnet32.old") ("C:\KIX32\BACKUP\")
DEL ("C:\KIX32\msnet32.old")
ENDIF
IF EXIST ("C:\KIX32\autoexec.m32") = 1
COPY ("C:\KIX32\autoexec.m32") ("C:\KIX32\BACKUP\")
DEL ("C:\KIX32\autoexec.m32")
ENDIF
IF EXIST ("C:\KIX32") = 0 MD ("C:\KIX32")
ENDIF
IF EXIST ("C:\KIX32\@WKSTA") = 0 MD ("C:\KIX32\@WKSTA")
ENDIF
IF EXIST ("C:\KIX32\BACKUP") = 0 MD ("C:\KIX32\BACKUP")
ENDIF
IF EXIST ("C:\KIX32\TEMP") = 0 MD ("C:\KIX32\TEMP")
ENDIF
IF EXIST ("C:\KIX32\TEMP") = 1 DEL ("C:\KIX32\Temp\*.*")
ENDIF
IF EXIST ("C:\KIX32\SORT") = 0 MD ("C:\KIX32\SORT")
ENDIF
IF EXIST ("C:\KIX32\sort*.*") = 1 DEL ("C:\KIX32\sort*.*")
ENDIF
IF EXIST ("C:\KIX32\EXTERNAL") = 0 MD ("C:\KIX32\EXTERNAL")
ENDIF
IF EXIST ("C:\KIX32\*.tag") = 0 DEL ("C:\KIX32\*.tag")
ENDIF
IF EXIST ("C:\KIX32\INVENTORY") = 0 MD ("C:\KIX32\Inventory")
ENDIF
IF EXIST ("C:\KIX32\Inv*.*") = 1 DEL ("C:\KIX32\Inv*.*")
ENDIF
; ******************************************************************************
; Create Variables
; ******************************************************************************
CLS
Color Y+/N
AT (5,17) "Please wait while we inventory your system...!"
Color G+/N
AT (6,15) "__________________________________________________"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+CHR(13)+CHR(10)
; SETCONSOLE ("HIDE")
$output=RedirectOutput("C:\Kix32\Temp\inventory.dat")
Color N+/N
$UserID="Undetermined User" ; User NT Account
$UserNM="Undetermined Fullname" ; User FullName
$UserDM="Undetermined Domain" ; User Domain
$UserPG="Undetermined Primairy" ; User PrimaryGroup
$SystNM="Undetermined System name" ; System Name
$SystIP="Undetermined IP Adress" ; System IP Address
$SystMC="Undetermined MAC Adress" ; System MAC Address
$Unc ="No Network printer installed" ; Network printers
$Lpt ="No Local printer installed" ; Local Printers
; Select OS modifications
:OSMod
SELECT
CASE @InWin = 1
$CommandOption = "/X /C"
$DirOption = "/T /b"
$SortOption = "/R"
CASE @InWin = 2
$CommandOption = "/C"
$DirOption = "/O /D /b"
$SortOption = "/R"
ENDSELECT
;******************************************************************************
;** Preset Info
;******************************************************************************
:PreInfo
$FLServer="NTADAMPDC" ; Collects information on 1 server only
$Date=SUBSTR(@DATE,1,4)+"_"+SUBSTR(@DATE,6,2)+"_"+SUBSTR(@DATE,9,2)
$UserID=@USERID
$UserNM=@FULLNAME
$UserDM=@LDOMAIN
$SystNM=@WKSTA
$SystIP0=LTRIM(SUBSTR(@IPADDRESS0,1,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,5,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,9,3))+"."+LTRIM(SUBSTR(@IPADDRESS0,13,3))
$SystIP1=LTRIM(SUBSTR(@IPADDRESS1,1,3))+"."+LTRIM(SUBSTR(@IPADDRESS1,5,3))+"."+LTRIM(SUBSTR(@IPADDRESS1,9,3))+"."+LTRIM(SUBSTR(@IPADDRESS1,13,3))
$UserPG=@PRIMARYGROUP
$SystMC0=SUBSTR(@ADDRESS0,1,2)+":"+SUBSTR(@ADDRESS0,3,2)+":"+SUBSTR(@ADDRESS0,5,2)+":"+SUBSTR(@ADDRESS0,7,2)+":"+SUBSTR(@ADDRESS0,9,2)+":"+SUBSTR(@ADDRESS0,11,2)
;******************************************************************************
;** Get OS Information
;******************************************************************************
:GetSYSInfo
select
Case @inwin=1
$kernel="WinNT"
$type=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
select
Case @dos=5.0
$system="Windows 2000 "
select
Case $type<>"WinNT"
$flavor="Server"
Case $type="WinNT"
$flavor="Professional"
endselect
Case @dos=4.0
$system="Windows NT4 "
select
Case $type="LANMANNT"
$flavor="Domain Controller"
Case $type="ServerNT"
$flavor="Member Server"
Case $type="WinNT"
$flavor="Workstation"
endselect
endselect
$Svcpack=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
Case @inwin=2
$kernel="Windows 9x"
$SubVer=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
select
Case @dos="4.90"
$system="Windows ME"
$flavor="A"
Case @dos="4.10"
$system="Windows 98"
select
Case $subver=" A "
$flavor="Second Edition"
Case $subver="a" OR $subver="a"
$flavor="OEM"
endselect
Case @dos="4.0"
$system="Windows 95"
select
Case $subver=" C"
$flavor="OSR 2.5"
Case $subver=" B"
$flavor="OSR 2"
Case $subver="" OR $subver="a"
$flavor="OEM"
endselect
endselect
$Svcpack = "Not Available"
Case 1
$kernel = "Undetermined"
$system = "Undetermined"
$flavor = "Undetermined"
$Svcpack = "Undetermined"
endselect
;******************************************************************************
;** Installed Software
;******************************************************************************
OPEN(1,"C:\Kix32\Temp\Tmp1.dat",5)
$SIDN=0
$SID=ENUMKEY("HKEY_USERS\",$SIDN)
WHILE @ERROR=0
$KEYN=0
$KEY=ENUMKEY("HKEY_USERS\$SID\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
WHILE @ERROR=0
$VALUE=READVALUE("HKEY_USERS\$SID\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","DisplayName")
IF $VALUE=""
$VALUE=READVALUE("HKEY_USERS\$SID\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","Title")
ENDIF
IF $VALUE<>""
$VALUE=$VALUE+CHR(13)+CHR(10)
WRITELINE(1,$VALUE)
ENDIF
$KEYN=$KEYN+1
$KEY=ENUMKEY("HKEY_USERS\$SID\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
LOOP
$SIDN=$SIDN+1
$SID=ENUMKEY("HKEY_USERS\",$SIDN)
LOOP
$KEYN=0
$KEY=ENUMKEY("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
WHILE @ERROR=0
$VALUE=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","DisplayName")
IF $VALUE=""
$VALUE=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","Title")
ENDIF
IF $VALUE<>""
$VALUE=$VALUE+CHR(13)+CHR(10)
WRITELINE(1,$VALUE)
ENDIF
$KEYN=$KEYN+1
$KEY=ENUMKEY("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
LOOP
$KEYN=0
$KEY=ENUMKEY("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
WHILE @ERROR=0
$VALUE=READVALUE("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","DisplayName")
IF $VALUE=""
$VALUE=READVALUE("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$KEY","Title")
ENDIF
IF $VALUE<>""
$VALUE=$VALUE+CHR(13)+CHR(10)
WRITELINE(1,$VALUE)
ENDIF
$KEYN=$KEYN+1
$KEY=ENUMKEY("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\",$KEYN)
LOOP
CLOSE(1)
;******************************************************************************
;** Sort Installed Software
;******************************************************************************
IF (($system="Windows NT4 ") OR ($system="Windows 2000 "))
DEL ("C:\KIX32\INVENTORY\Inv*.*")
COPY @SCRIPTDIR + "\UPDATES\INVENTORY\NT\InventNT*.*" "C:\KIX32\INVENTORY\"
ELSE
DEL ("C:\KIX32\INVENTORY\Inv*.*")
COPY @SCRIPTDIR + "\UPDATES\INVENTORY\W9x\Inv*.*" "C:\KIX32\INVENTORY\"
ENDIF
select
case $system = "Windows NT4 "
IF EXIST ("C:\KIX32\SORT\sortNT.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\SortNT.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sortNT.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case $system = "Windows 2000 "
IF EXIST ("C:\KIX32\SORT\sort2k.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\Sort2k.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sort2k.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case $system = "Windows 95" AND $flavor="OEM" ; Windows 95a
IF EXIST ("C:\KIX32\SORT\sort95a.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\Sort95a.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sort95a.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case $system = "Windows 95" AND $flavor <> "OEM" ; Windows 95b/c
IF EXIST ("C:\KIX32\SORT\sort95.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\Sort95.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sort95.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case $system = "Windows 98"
IF EXIST ("C:\KIX32\SORT\sort98.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\Sort98.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sort98.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case $system = "Windows ME"
IF EXIST ("C:\KIX32\SORT\sortME.*")=0
COPY @SCRIPTDIR + "\Updates\SORT\SortME.exe" "C:\KIX32\SORT\"
ENDIF
SHELL "%Comspec% $CommandOption C:\KIX32\SORT\sortME.exe < C:\KIX32\Temp\Tmp1.dat > C:\KIX32\Temp\Tmp2.dat"
case 1
COPY "C:\KIX32\Temp\Tmp1.dat" "C:\KIX32\Temp\Tmp2.dat"
endselect
;******************************************************************************
;** Printer info
;******************************************************************************
:Printer
$INDEX=0
$Loop = "Y"
While $Loop = "Y"
$ValueKey = ENUMKEY("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers", $Index)
If @ERROR = 0
If $Index = 0
$Unc=$ValueKey + ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\", "Port")
Else
; $Lpt=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\" + $ValueKey, "Port")
$Lpt=$ValueKey + ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\", "Port")
Endif
$Index = $Index + 1
Else
$Loop = "N"
Endif
LOOP
;******************************************************************************
;** CPU info
;******************************************************************************
IF EXIST ("C:\Kix32\External\cpu.exe") = 0
COPY @SCRIPTDIR + "\Updates\External\cpu.exe" "C:\Kix32\External\"
ENDIF
$Tmp_directory=("C:\Kix32\Temp")
$Cpu_file=$tmp_directory+"\cpu.dat"
$Cpu_program="C:\Kix32\External\Cpu.exe"
$Cpu="??? MHz"
$Processor="???"
Shell "%Comspec% /c "+$Cpu_program+" >"+$Cpu_file
IF (Open(9,$Cpu_file) = 0)
$Result=ReadLine(9) ; - skip -
$Result=ReadLine(9)
IF (Len($Result) > 3)
$cpu=LTRIM(RTRIM(Substr($result,Instr($result,",")+1,Len($result)-Instr($result,","))))
$Processor=LTRIM(RTRIM(Substr($result,Instr($result,":")+2,Len($result)-Instr($result,":")-2+1)))
ENDIF
IF (Close(9) <> 0)
ENDIF
ENDIF
;******************************************************************************
;** Memory Info for W9x / NT4 / W2k
;** External programs: memory.exe, winmsd.exe (nt), mem.exe (95)
;******************************************************************************
$debug_mode="no" ; yes = temporary files will not be deleted
$memory_file="memory.exe"
$local_drive="c:\kix32"
MD $local_drive+"\temp"
IF (@error = 0)
ENDIF
IF EXIST ("C:\KIX32\External\memory.exe") = 0
COPY @SCRIPTDIR + "\Updates\External\memory.exe" "C:\Kix32\External\"
ENDIF
IF (@inwin = 1)
$NT_mode="yes"
IF (Exist("c:\kix32\external\"+$memory_file) = 1)
$memory_file="c:\kix32\external\"+$memory_file
ENDIF
ELSE
$NT_mode="no"
IF (Exist("c:\kix32\external\"+$memory_file) = 1)
$memory_file="c:\kix32\external\"+$memory_file
ENDIF
ENDIF
$os_type=""
SELECT
CASE ($NT_mode = "yes") AND (@dos = "5.0") ; - Windows 2000 -
$os_type="W2K"
CASE ($NT_mode = "yes") ; - Windows NT -
$os_type="NT4"
CASE ($NT_mode <> "yes") AND (@dos = "4.90") ; - Windows ME -
$os_type="ME"
CASE ($NT_mode <> "yes") AND (@dos = "4.10") ; - Windows 98 -
$os_type="W98"
CASE ($NT_mode <> "yes") AND (@dos = "4.0") ; - Windows 95 -
$os_type="W95"
CASE 1
$os_type="???" ; - undetermined -
ENDSELECT
; - :script_memory
$memory=0
IF (exist($memory_file) = 1)
;Physical memory is 133599232 bytes - memory.exe -
;
;133599232 - memory.exe /s -
IF (exist($local_drive+"\temp\memory.txt") = 1)
del $local_drive+"\temp\memory.txt"
ENDIF
shell "%comspec% /c "+$memory_file+" /s >"+$local_drive+"\temp\memory.txt"
IF (open(9,$local_drive+"\temp\memory.txt") = 0)
$result=ReadLine(9)
IF (len($result) > 3)
$memory=Val(LTRIM(RTRIM($result)))/1024
IF (len("$memory") <= 8)
$memory=substr(" ",1,9-len("$memory"))+$memory
ENDIF
ENDIF
IF (CLOSE(9) <> 0)
ENDIF
ENDIF
IF (exist($local_drive+"\temp\memory.txt") = 1)
IF ($debug_mode <> "yes")
del $local_drive+"\temp\memory.txt"
ENDIF
ENDIF
? "Memory (memory.exe): "+LTRIM(RTRIM($memory))+" KBytes"
ENDIF
;
IF ($memory = 0)
IF ($NT_mode = "yes") AND ($os_type <> "W2K") ; - "W2K_Professional" + "W2K_Server" -
;
;Physical Memory (K)
; Total: 64,948
; Available: 31,840
; File Cache: 14,652
;
IF (exist($local_drive+"\temp\"+@wksta+".txt") = 1)
del $local_drive+"\temp\"+@wksta+".txt"
ENDIF
IF (exist($local_drive+"\temp\memory.txt") = 1)
del $local_drive+"\temp\memory.txt"
ENDIF
cd $local_drive+"\temp"
shell "%comspec% /c winmsd /s /f" ; - /s = summary; /f = to file -
shell '%comspec% /c echo Total: 0 >'+$local_drive+'\temp\memory.txt'
shell '%comspec% /c echo. >>'+$local_drive+'\temp\memory.txt'
shell '%comspec% /c type '+@wksta+'.txt | find " Total:" >>'+$local_drive+'\temp\memory.txt'
IF (open(9,$local_drive+"\temp\memory.txt") = 0)
$result=ReadLine(9)
WHILE (@error = 0)
$pos=INSTR(LCASE($result), "total:")
IF ($pos <> 0)
$memory=substr($result,$pos+6,len($result)-$pos-1)
ENDIF
$result=ReadLine(9)
LOOP
IF (CLOSE(9) <> 0)
ENDIF
ENDIF
ENDIF
IF ($NT_mode <> "yes")
;
;Memory Type Total Used Free
;---------------- -------- -------- --------
;Conventional 640K 86K 554K
;Upper 0K 0K 0K
;Reserved 0K 0K 0K
;Extended (XMS) 65.472K ? 129.764K
;---------------- -------- -------- --------
;Total memory 66.112K ? 130.318K
;
IF (exist($local_drive+"\temp\mem.txt") = 1)
del $local_drive+"\temp\mem.txt"
ENDIF
IF (exist($local_drive+"\temp\memory.txt") = 1)
del $local_drive+"\temp\memory.txt"
ENDIF
shell "%comspec% /c mem >"+$local_drive+"\temp\mem.txt"
shell '%comspec% /c echo Total memory 0K ? 0K >'+$local_drive+'\temp\memory.txt'
shell '%comspec% /c echo. >>'+$local_drive+'\temp\memory.txt'
shell '%comspec% /c type '+$local_drive+'\temp\mem.txt | find "Total memory" >>'+$local_drive+'\temp\memory.txt'
shell '%comspec% /c type '+$local_drive+'\temp\mem.txt | find "Totaal geheugen" >>'+$local_drive+'\temp\memory.txt'
;
IF (open(9,$local_drive+"\temp\memory.txt") = 0)
$result=ReadLine(9)
WHILE (@error = 0)
$result=RTRIM($result)
$pos=INSTR(LCASE($result), "total memory")
IF ($pos <> 0) AND ($memory = 0)
$memory=LTRIM(RTRIM(substr($result,39,len($result)-39)))
ENDIF
$pos=INSTR(LCASE($result), "totaal geheugen")
IF ($pos <> 0) AND ($memory = 0)
$memory=LTRIM(RTRIM(substr($result,39,len($result)-39)))
ENDIF
$result=ReadLine(9)
LOOP
IF (CLOSE(9) <> 0)
ENDIF
ENDIF
ENDIF
IF (exist($local_drive+"\temp\"+@wksta+".txt") = 1)
del $local_drive+"\temp\"+@wksta+".txt"
ENDIF
IF (exist($local_drive+"\temp\mem.txt") = 1)
IF ($debug_mode <> "yes")
del $local_drive+"\temp\mem.txt"
ENDIF
ENDIF
IF (exist($local_drive+"\temp\memory.txt") = 1)
IF ($debug_mode <> "yes")
del $local_drive+"\temp\memory.txt"
ENDIF
ENDIF
IF ($os_type <> "W2K") ; - "W2K_Professional" + "W2K_Server" -
$memory=LTRIM(RTRIM("$memory"))
IF (len("$memory") <= 8)
$memory=substr(" ",1,9-len("$memory"))+$memory
ENDIF
;
IF ($NT_mode = "yes")
? "Memory.NT[winmsd]: "+LTRIM(RTRIM($memory))+" KBytes"
ELSE
? "Memory.95[mem]: "+LTRIM(RTRIM($memory))+" KBytes"
ENDIF
ELSE
? "Memory.W2K[winmsd]: ? KBytes"
ENDIF
ENDIF
;******************************************************************************
;** Process Info
;******************************************************************************
:ProInfo
IF EXIST ("C:\KIX32\@WKSTA\@WKSTA_$Date.DOC")=1 DEL ("C:\KIX32\@WKSTA\@WKSTA_$Date.DOC")
ENDIF
OPEN(1,"C:\KIX32\@WKSTA\@WKSTA_$Date.DOC",5)
;------------------------------------------------------------------------------
IF $system="Windows NT4 " OR $system="Windows 2000 " ; Reading the computers network comment
$SystCM="Not Available on NT4 and W2k machines!"
Else
$SystCM=ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\", "Comment")
Endif
;------------------------------------------------------------------------------
$FILL="| |"
WRITELINE(1,"+-----------------------[ System & User Informationsheet ]---------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"| User NT Account : $UserID"+SUBSTR($FILL,25+LEN($UserID),55-LEN($UserID))+CHR(13)+CHR(10))
WRITELINE(1,"| User FullName : $UserNM"+SUBSTR($FILL,25+LEN($UserNM),55-LEN($UserNM))+CHR(13)+CHR(10))
WRITELINE(1,"| User Domain : $UserDM"+SUBSTR($FILL,25+LEN($UserDM),55-LEN($UserDM))+CHR(13)+CHR(10))
WRITELINE(1,"| User PrimaryGroup : $UserPG"+SUBSTR($FILL,25+LEN($UserPG),55-LEN($UserPG))+CHR(13)+CHR(10))
WRITELINE(1,"| System Name : $SystNM"+SUBSTR($FILL,25+LEN($SystNM),62-LEN($SystNM))+CHR(13)+CHR(10))
WRITELINE(1,"| System Comment : $SystCM"+SUBSTR($FILL,25+LEN($SystCM),62-LEN($SystCM))+CHR(13)+CHR(10))
WRITELINE(1,"| System IP# 0 : $SystIP0"+SUBSTR($FILL,25+LEN($SystIP0),62-LEN($SystIP0))+CHR(13)+CHR(10))
WRITELINE(1,"| System IP# 1 : $SystIP1"+SUBSTR($FILL,25+LEN($SystIP1),62-LEN($SystIP1))+CHR(13)+CHR(10))
WRITELINE(1,"| System MAC : $SystMC0"+SUBSTR($FILL,25+LEN($SystMC0),62-LEN($SystMC0))+CHR(13)+CHR(10))
WRITELINE(1,"| System OS : $System"+" / $flavor"+SUBSTR($FILL,25+LEN($System),62-LEN($System))+CHR(13)+CHR(10))
WRITELINE(1,"| Service Pack (NT) : $Svcpack"+SUBSTR($FILL,25+LEN($Svcpack),62-LEN($Svcpack))+CHR(13)+CHR(10))
WRITELINE(1,"| Processor Type/Speed : $processor"+SUBSTR($FILL,25+LEN($processor),62-LEN($processor))+CHR(13)+CHR(10))
WRITELINE(1,"| Available Memory : " +LTRIM(RTRIM($memory)) +" KBytes"+SUBSTR($FILL,25+LEN($memory),62-LEN($memory))+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"+--------------------------[ Persistent System Mounts ]------------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
;******************************************************************************
;** Persistant Connections
;******************************************************************************
SHELL '%Comspec% $CommandOption NET USE | FIND "\\" > C:\KIX32\Temp\Netuse.dat'
OPEN(3,"C:\KIX32\Temp\Netuse.dat",2)
$map=READLINE(3)
IF $map
WHILE @ERROR=0
WRITELINE(1,"| $map"+SUBSTR($FILL,25+LEN($map),78-LEN($map))+CHR(13)+CHR(10))
$map=READLINE(3)
LOOP
ENDIF
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"+--------------------------[ Persistent Printer Mounts ]-----------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"| $Unc"+SUBSTR($FILL,25+LEN($Unc),78-LEN($Unc))+CHR(13)+CHR(10))
WRITELINE(1,"| $Lpt"+SUBSTR($FILL,25+LEN($Lpt),78-LEN($Lpt))+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
CLOSE(3)
;******************************************************************************
;** McAfee Inventory
;******************************************************************************
$regPath = "HKEY_LOCAL_MACHINE\SOFTWARE"
SELECT
CASE $VS403Code = ExistKey($regPath + "Network Associates\McAfee VirusScan")
CASE $NS403aCode = ExistKey($regPath + "Network Associates\NetShield NT") ; Server version
CASE $NS403aCode = ExistKey($regPath + "Network Associates\VirusScan NT") ; Workstation version
CASE $VS45Code = ExistKey($regPath + "Network Associates\TVD\VirusScan")
CASE $VS45Code = ExistKey($regPath + "Network Associates\TVD\NetShield NT")
CASE 1
ENDSELECT
SELECT
CASE $VS403Code=0
$McAfeeVersion = "McAfee VirusShield : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szProductVer"),1,53)
$EngineVersion = "McAfee EngineVersion : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szEngineVer"),1,53)
$DatfileVersion = "McAfee DAT Version : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szVirDefVer"),1,53)+ " / Date: "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szVirDefDate"),1,53)
CASE $NS403aCode=0
$McAfeeVersion = "McAfee NetShield : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szProductVer"),1,53)
$EngineVersion = "McAfee EngineVersion : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szEngineVer"),1,53)
$DatfileVersion = "McAfee DAT Version : "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szVirDefVer"),1,53)+ " / Date: "+SUBSTR(READVALUE("$regPath\McAfee\VirusScan","szVirDefDate"),1,53)
CASE $VS45Code=0
$McAfeeVersion = "McAfee VirusShield : "+SUBSTR(READVALUE("$regPath\Network Associates\TVD\NetShield NT\CurrentVersion","szProductVer"),1,53)
$EngineVersion = "McAfee Engine Version : "+SUBSTR(READVALUE("$regPath\Network Associates\TVD\NetShield NT\CurrentVersion","szEngineVer"),1,53)
$DatfileVersion = "McAfee DAT Version : "+SUBSTR(READVALUE("$regPath\Network Associates\TVD\NetShield NT\CurrentVersion","szVirDefVer"),1,53)+ " / Date: "+SUBSTR(READVALUE("$regPath\Network Associates\TVD\NetShield NT\CurrentVersion","szVirDefDate"),1,53)
CASE 1
$McAfeeVersion = "McAfee Program Version : Undetermined"
$EngineVersion = "McAfee Engine Version : Undetermined"
$DatfileVersion = "McAfee Datfile Version : Undetermined"
ENDSELECT
WRITELINE(1,"+----------------------------[ McAfee Virusscan ]------------------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"| $McAfeeVersion" +SUBSTR($fill,2+LEN($McAfeeVersion), LEN($fill)-LEN($McAfeeVersion)) +CHR(13)+CHR(10))
WRITELINE(1,"| $EngineVersion" +SUBSTR($fill,2+LEN($EngineVersion), LEN($fill)-LEN($EngineVersion)) +CHR(13)+CHR(10))
WRITELINE(1,"| $DatfileVersion" +SUBSTR($fill,2+LEN($DatfileVersion), LEN($fill)-LEN($DatfileVersion)) +CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
WRITELINE(1,"+-------------------------[ Installed Applications ]---------------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| |"+CHR(13)+CHR(10))
;******************************************************************************
;** Apps Inventory
;******************************************************************************
$LC=2
OPEN(2,"C:\KIX32\Temp\Tmp2.dat")
$Apps=READLINE(2)
WHILE @ERROR=0
IF $Apps<>$PrevApps
WRITELINE(1,"| $Apps"+SUBSTR($FILL,2+LEN($Apps),78-LEN($Apps))+CHR(13)+CHR(10))
$LC=$LC+1
; IF $LC=45
; $Apps="Other."
; WRITELINE(1,"| $Apps"+SUBSTR($FILL,2+LEN($Apps),78-LEN($Apps))+CHR(13)+CHR(10))
; CLOSE(2)
; ENDIF
ENDIF
$PrevApps=$Apps
$Apps= READLINE(2)
LOOP
CLOSE(2)
DO
WRITELINE(1,"| |"+CHR(13)+CHR(10))
$LC=$LC+1
; UNTIL $LC=50
$PM="Info for System "+$SystNM+" and User "+$UserNM+" on "+@DATE+" at "+@TIME
WRITELINE(1,"+------------------------------------------------------------------------------+"+CHR(13)+CHR(10))
WRITELINE(1,"| $PM"+SUBSTR($FILL,2+LEN($PM),78-LEN($PM))+CHR(13)+CHR(10)+CHR(13)+CHR(10))
CLOSE(1)
;******************************************************************************
;** Office Version Inventory
;******************************************************************************
:Office
If 1 = 1
DIM $file, $HKLMAppPaths, $app, $path, $version, $nul, $index
$HKLMAppPaths = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
$file = "C:\KIX32\@WKSTA\@WKSTA_$Date.DOC"
while @error = 0
$app = enumkey("$HKLMAppPaths\",$index) $index = $index + 1
select
case $app = "excel.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Suite"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $esr")
case $app = "winword.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Suite"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $esr")
case $app = "powerpnt.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Suite"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $esr")
case $app = "msaccess.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Access"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $asr")
case $app = "mspub.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Publisher"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $psr")
case $app = "winproj.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
Gosub "Project"
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version / $prsr")
case $app = "visio32.exe"
$path = readvalue("$HKLMAppPaths\$app","")
$version = getfileversion("$path","Productversion")
$nul = writeprofilestring($file,"Installed Office Suite:","$app","$version")
endselect
loop
endif
GOTO "InvDir"
;******************************************************************************
;** Office Suite Determination
;******************************************************************************
:Suite
select
case $version=7.0
$esr="MS Office95"
case $version=7.0a
$esr="MS Office95 Pro"
case $version=8.0
$esr="MS Office97 SR-0"
case $version=8.0a
$esr="MS Office97 SR-1"
case $version=8.0b
$esr="MS Office97 SR-2"
case $version=8.0e
$esr="MS Office97 SR-2"
case $version=9.0.2719
$esr="MS Office2000"
case $version=9.0.3822
$esr="MS Office2000 SR-1a"
case 1
$esr="Undetermined"
endselect
Return
:Access
select
case $version=8.0.3512
$asr="MS Access97 SR-0"
case $version=8.0.4122
$asr="MS Access97 SR-1"
case $version=8.0.5903
$asr="MS Access97 SR-2"
case $version=9
$asr="MS Access2000"
case $version=9.0.3822
$asr="MS Access2000 SR-1a"
case 1
$asr="Undetermined"
endselect
Return
:Publisher
select
case $version=4.0
$psr="MS Publisher 97"
case $version=5.0
$psr="MS Publisher 98"
case $version=6.0
$psr="MS Publisher 2000"
case 1
$psr="Undetermined"
endselect
Return
:Project
select
case $version=8.0
$prsr="MS Project 98"
case $version=9.0
$prsr="MS Project 2000"
case 1
$prsr="Undetermined"
endselect
Return
;******************************************************************************
;** Copy the Inventory to the right Directory, and create the appr. directory
;******************************************************************************
:InvDir
$Filecopy="\\$FLServer\Workstations"
select
case @LDOMAIN="NTADAM.DOM"
$Geo="Amsterdam"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
case @LDOMAIN="NTBODE.DOM"
$Geo="Bodegraven"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
case @LDOMAIN="NTGELDER.DOM"
$Geo="Geldermalsen"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
case @LDOMAIN="NTLAREN.DOM"
$Geo="Laren"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
case @LDOMAIN="NTLIER.DOM"
$Geo="Lier"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
case @LDOMAIN="NTMYD.DOM"
$Geo="Mydrecht"
$Location="$Filecopy\$Geo"
Gosub Dircheck
Goto FCopy
endselect
;******************************************************************************
ircheck
If Exist ("$Location")=0
MD ("$Location")
Endif
Return
;******************************************************************************
:FCopy
If Exist ("C:\KIX32\@WKSTA\Copy_Inv.bat")=1 ; Cleanup Old Stiuation
Del ("C:\KIX32\@WKSTA\Copy_Inv.bat")
Endif
If Exist ("C:\KIX32\INVENTORY\Copy_Inv.bat")=1 ; Refresh the command file
Del ("C:\KIX32\INVENTORY\Copy_Inv.bat")
Endif
;******************************************************************************
;** Create the command file to copy Client's Inventory to Server
;******************************************************************************
$CMsg0 = "@@ECHO OFF" + chr(13) + chr(10)
$CMsg1 = "NET USE Z: /DELETE" + chr(13) + chr(10)
$CMsg2 = "NET USE Z: $Filecopy" + chr(13) + chr(10)
$CMsg3= "XCOPY /Q /I C:\KIX32\@WKSTA\*.DOC Z:\$Geo\@WKSTA" + chr(13) + chr(10) + chr(13) + chr(10)
$CMsg4= "REM: Run this file copy inventory from system to central directory" + chr(13) + chr(10)
$Temp = Open(1, "C:\KIX32\INVENTORY\Copy_Inv.bat", 5)
$Temp = WriteLine(1, $CMsg0)
$Temp = WriteLine(1, $CMsg1)
$Temp = WriteLine(1, $CMsg2)
$Temp = WriteLine(1, $CMsg3)
$Temp = WriteLine(1, $CMsg4)
$Temp = Close(1)
SHELL "%Comspec% $CommandOption C:\KIX32\INVENTORY\Copy_Inv.bat"
:END
IF EXIST ("Z:\AMSTERDAM") = 1
USE Z: /DEL /PERSISTENT
ENDIF
EXIT
The only problem is that the script normaly starts up from the "Runonce" Key, and that you are missing 2 .BAT files to copy the inventory document(placed in C:\KIX32\@WKSTA), to a shared drive.
You'll have to figure this out for yourself...