WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

SystemInfo Plus Office Version


There are lost of these "system assessing" scripts floating around. Here's the one I came up with that includes the M$ Office version. The IP/MAC address stuff came from the Tech DataBase, but needed a hack for Win95 machines.

;;***************************************************************************
;; Filename: surveyor.wbt 
;; Author: Craig Storey
;; Date:   2001/03/21
;;
;; Quickly scan a system for the usual parameters...
;;
;; Modified: 2003/12/15... Get M$ Office info from registry.
;;***************************************************************************

home=FilePath(IntControl(1004,0,0,0,0))

IntControl(1002,0,0,0,0)                                    ;; Hide WIL Box
IntControl(49,1,0,0,0)                                       ;; Add Dialog Min/Close

;   AddExtender("WWCPU34I.DLL")
Exclusive(@ON)                                                ;; Faster Daddy, faster!!
;DebugTrace(@ON, StrCat(home, "DTrace.txt"))

;***************************************************************************

; Mess == "The text for the ouput "Message" or file.

;***************************************************************************
mess="==========================================================="

;***************************************************************************

; Date and Time of execution

;***************************************************************************
curtime=TimeYmdHms()
dcurtime=StrSub(curtime, 1, 10)
dcurtime=StrReplace(dcurtime, ":", "/")
tcurtime=StrSub(curtime, 12, -1)
mess=StrCat(mess, @CRLF, "Date: ", dcurtime,", Time: ", tcurtime)
mess=StrCat(mess, @CRLF,"===========================================================")

;***************************************************************************

; User Name

;***************************************************************************
curruser = Environment("username")
mess=StrCat(mess, @CRLF, @CRLF, "USER:         ", curruser)

;***************************************************************************

; Computer Name

;***************************************************************************
sysinfo = WinSysInfo( )
computer  = ItemExtract(1, sysinfo, @TAB)
mess=StrCat(mess, @CRLF, "COMPUTER:      ", computer)
mess=StrCat(mess, @CRLF)

;***************************************************************************

; Gets CPU info... Processor type and speed.  (INTEL ONLY!)

;***************************************************************************

#DefineFunction udf_cpuid()

   AddExtender("WWCPU34I.DLL")
   e0 = cCpuSpeed(0)
   Proctype="Unknown"

   If cCpuSupt() == @FALSE
      Proctype="Unknown"
      results=StrCat("Processor Type =  Non-Intel - ", e0, "MHz")
   Else
      e0 = cCpuSpeed(0)
      procid=cCpuId()
      cputypeext = cCpuIdExt()
      cpustep=cputypeext & 15
      cpumodel=(cputypeext >> 4) & 15
      cpufamily=(cputypeext >> 8) & 15
      cputype=(cputypeext >> 12) & 3
      pdata="Standard OEM CPU|OverDrive|Dual CPU|Reserved"
      cpuprocessorstring=ItemExtract(cputype+1,pdata,"|")

      Select procid
         Case 1
            Proctype="8086"
            Break
         Case 2
            Proctype="80286"
            Break
         Case 3
            Proctype="80386"
            Break
         Case 4
            Proctype="80486"
            Break
         Case 5
            Proctype="Pentium"
            If cputype == 0 && cpufamily == 5 && cpumodel < 4  Then Proctype = "Pentium w/o MMX"
            If cputype == 1 && cpufamily == 5 && cpumodel < 4  Then Proctype = "Pentium Overdrive w/o MMX"
            If cputype == 0 && cpufamily == 5 && cpumodel >= 4 Then Proctype = "Pentium MMX"
            If cputype == 1 && cpufamily == 5 && cpumodel >= 4 Then Proctype = "Pentium Overdrive MMX"
            Break
         Case 6
            If cputype == 0 && cpufamily == 6 && cpumodel == 1 Then Proctype = "Pentium Pro"
            If cputype == 0 && cpufamily == 6 && cpumodel >  1 Then Proctype = "Pentium II/III"
            If cputype == 0 && cpufamily == 6 && cpumodel == 3 Then Proctype = "Pentium II Model 3"
            If cputype == 0 && cpufamily == 6 && cpumodel == 5 Then Proctype = "Pentium II or Pentium II Xeon or Celeron Model 5"
            If cputype == 0 && cpufamily == 6 && cpumodel == 6 Then Proctype = "Celeron Model 6"
            If cputype == 0 && cpufamily == 6 && cpumodel >= 7 Then Proctype = "Pentium III or Pentiun III Xeon"
            If cputype == 1 && cpufamily == 6                  Then Proctype = "Pentium II Overdrive"
            Break
      EndSelect      
   EndIf
   results=StrCat("PROCESSOR:      Intel ", proctype, " @ ", e0, "MHz")
   Return results
#EndFunction

mess=StrCat(mess, @CRLF, udf_cpuid())

;***************************************************************************

; Screen Resolution...



;***************************************************************************
screen_width=WinMetrics(0);   Width of screen, in pixels
screen_height=WinMetrics(1);   Height of screen, in pixels
mess=StrCat(mess, @CRLF, "SCREEN RES:      ", screen_width, " x ", screen_height)

;***************************************************************************

; Memory...

;***************************************************************************

mem0 = (WinResources(0)+0.0)/(1024*1024*1024)   ;;GB
mem1 = (WinResources(1)+0.0)/(1024*1024*1024)   ;;GB
mem2 = (WinResources(11))/(1024*1024)         ;;MB
mem3  = WinResources(10)
res1 = WinResources(2)
res2 = WinResources(3)
res3 = WinResources(4)
mess=StrCat(mess, @CRLF, "RAM:         ", mem2, " MB")
mess=StrCat(mess, @CRLF,"FREE RESOURCES:      ",mem3," %%")


;***************************************************************************

; Drive Info.. HD, Floppy, CD, Zip, etc...

;***************************************************************************

floppy=DiskScan(1)
HDs=DiskScan(2)
Net=DiskScan(4)
CDs=DiskScan(8)

;; Get disk Sizes to 2 decimals

Decimals(2)  
HDsizes=""
ndrives=ItemCount(HDs, @TAB)
For ii=1 To ndrives
   xdrive=ItemExtract(ii, HDs, @TAB)
   size=DiskSize(xdrive)
   size=size/(1024*1024*1024)
   HDsizes=StrCat(HDsizes, size,@TAB)
Next

HDsizes=StrTrim(HDsizes)

;; Make it pretty for display

floppy=StrReplace(floppy, @TAB, " + ")
HDs=StrReplace(HDs, @TAB, " + ")
HDsizes=StrReplace(HDsizes, @TAB, " + ")
Net=StrReplace(Net, @TAB, " + ")
CDs=StrReplace(CDs, @TAB, " + ")
mess=StrCat(mess, @CRLF, "FLOPPY/ZIP:      ", floppy, @CRLF, "Hard Drives:      ", HDs)
mess=StrCat(mess, @CRLF, "HD Sizes (GB):      ", HDsizes)
mess=StrCat(mess, @CRLF, "NETWORK:      ", Net, @CRLF, "CD-ROM|R|RW:      ", CDs)
mess=StrCat(mess, @CRLF)

;***************************************************************************

; Gets ip and mac information from current network card

; From WB Tech Support Database, no credits available...

;***************************************************************************

#DefineFunction GetTCPIPInfo_UDF(value)
      origdir        = DirGet()
      OutputFile     = StrCat (origdir, "IPCFG_TEMP.TXT")
      If WinVersion(4) == 4;WINNT      
         RunHideWait(Environment('COMSPEC'), '/c IPCONFIG /ALL >"%OutputFile%"')
      Else
        RunHideWait('WINIPCFG', '/ALL /BATCH > "%OutputFile%"')
      EndIf

      If !FileExist(OutputFile)
           MessageTxt = StrCat ("TCP/IP parameters can't be determined.", @CRLF)
           MessageTxt = StrCat (MessageTxt, @CRLF, "No data will be captured.", @CRLF)
           Message (Caption, MessageTxt)
           Exit
      EndIf
      fs        = FileSize (OutputFile)
      buf       = BinaryAlloc(fs)
      BinaryRead(buf, OutputFile)

      ; 
      ; Grab value from file
   	;
      lacptr = BinaryIndexEx(buf, 0, "Description", @FWDSCAN, 0)
      ptr  = BinaryIndexEx(buf, lacptr, value, @FWDSCAN, 0)
      colonptr    = BinaryIndexEx(buf, ptr, ":", @FWDSCAN, 0)
      CRLFptr     = BinaryIndexEx(buf, ptr, @CRLF, @FWDSCAN, 0)
      Address  = BinaryPeekStr(buf, colonptr+2, CRLFptr-colonptr-2)

      ; Clean up addresses a bit...
      Address = StrTrim(Address)
      Address = StrReplace(Address, @CRLF, "")
      Address = StrReplace(Address, @CR, "")
      Address = StrReplace(Address, @LF, "")
      Address = StrReplace(Address, "", "")
      BinaryFree (buf)
      ;FileDelete(OutputFile)
      Return Address
#EndFunction

; For pretty display...
value = "Physical Address"
mac = GetTCPIPInfo_UDF(value)
value = "IP Address"
ip = GetTCPIPInfo_UDF(value)
mess=StrCat(mess, @CRLF, "MAC Address:      ", mac)
mess=StrCat(mess, @CRLF, "IP Address:      ", ip)
mess=StrCat(mess, @CRLF)


;***************************************************************************

; Windows Version  (This is a User Defined Function plucked from another script!)

;***************************************************************************

#DefineFunction udf_WindowsVersion()
   v = WinVersion(5)
   Platfrom="Unknown"
   If v=="1-4-0" Then Platform="Windows 95"
   If v=="1-4-10" Then Platform="Windows 98"
   If v=="1-4-90" Then Platform="Windows ME"
   If v=="2-3-51" Then Platform="Windows NT 3.51"
   If v=="2-4-0" Then Platform="Windows NT 4.0"
   If v=="2-5-0" Then Platform="Windows 2000"
   If v=="2-5-1" Then Platform="Windows XP"
   Return platform
#EndFunction

mess=StrCat(mess, @CRLF, "WINDOWS VERSION:   ",  udf_WindowsVersion() )
mess=StrCat(mess, @CRLF, "WINDOWS BUILD:      ",  WinVersion(2) )
mess=StrCat(mess, @CRLF, "WINDOWS SP #:      ",  WinVersion(3) )
mess=StrCat(mess, @CRLF)

;***************************************************************************

; Registry Specific Stuff

; - Windows Service Pack Level

; - Bios version

; - M$ Office Version and Apps installed.

;***************************************************************************

msver=""
msapps=""

ErrorMode(@OFF)
sysbiosver = RegQueryMulSz(@REGMACHINE,"Hardware\Description\System\[SystemBiosVersion]",@TAB)
sysbiosdate = RegQueryValue(@REGMACHINE,"Hardware\Description\System\[SystemBiosDate]")

key=RegOpenKey(@REGMACHINE, "SOFTWARE\Microsoft\Office\")
If key!="" Then subkeylist=RegQueryKeys(key)

ErrorMode(@Cancel)
For ii=1 To ItemCount(subkeylist,@TAB)
   tvalue=ItemExtract(ii,subkeylist,@TAB)
   If IsNumber(tvalue) 
      msver=StrCat(msver, tvalue, ", ")
   Else
      msapps=StrCat(msapps, tvalue, ", ")
   EndIf
Next ii

; Results of Registry Search
mess=StrCat(mess, @CRLF, "BIOS VERSION:      ",  sysbiosver)
mess=StrCat(mess, @CRLF, "BIOS DATE:      ",  sysbiosdate)
mess=StrCat(mess, @CRLF)
mess=StrCat(mess, @CRLF, "M$ OFFICE VERSION:   ",  msver)
mess=StrCat(mess, @CRLF, "M$ OFFICE APPs:      ",  msapps)


; At this point you could get the Path to "winword.exe" or other installed app
; then use FileVersion() to get the 'exact' M$ Office version with SP info...
;
;AddExtender("wsrch34i.dll")
;srchInit(path, mask, strings, exclude mask, flags )

outfile=StrCat(home, "info_", computer, ".txt")

FilePut(outfile, mess)

ShellExecute(outfile, "", "", @NORMAL, "")
Return;

Article ID:   W16208
File Created: 2004:03:30:15:43:14
Last Updated: 2004:03:30:15:43:14