; *** File Name: mycomputerinfo.kix
; *** Date Created: 10/23/2003 7:33PM PST - By Ron Lewis
; *** Version: 1.02
; *** Last Date Modified: 10/24/2003 12:34PM PST - By Ron Lewis
debug off
break on
dim $iRC
$iRC=setoption('Explicit','on')
$iRC=setoption('NoVarsInStrings','on')
$iRC=setoption('WrapAtEOL','on')
dim $InfoMessageBox,$UserID,$FullName,$DomainMemberOf,$ProdType,$CSD,$Admin
dim $HKLMSCCS,$HKCUSMWCV,$HKLMSMWCV,$HKLMSMWNTCV,$HKCUSMWNTCV,$HKLMSMWCVAP
dim $CommonAppData,$Desktop,$StartMenu,$Favorites,$AllDesktop,$AllStartMenu
dim $Server,$CurrentIP,$CurrentOS,$FreeSpace,$CPU,$Mhz,$Ram,$ST,$SystemUpTime
dim $NAVInfo,$IE,$2KXP,$DNSHostName,$HostName,$MB,$InstallDate,$SupportNumber
dim $IPresults,$UserComment,$HomeDirectory,$LogonServer,$HomeDrive,$MaxPWAge,$PWAge
dim $PassExpires,$MacAdd,$ADSite,$OfficeApps,$NoNAVFound
$UserID = @USERID
$FullName = @FullName
$UserComment = @COMMENT
$HostName = @WKSTA
$MacAdd = @ADDRESS
$DNSHostName = @HOSTNAME
$DomainMemberOf = @DOMAIN
$ADSite = @SITE
$HomeDirectory = @HOMEDIR
$HomeDrive = @HOMEDRIVE
$LogonServer = @LDRIVE
$MaxPWAge = @MaxPWAge
$PWAge = @PWAge
$PassExpires = @maxpwage-@pwage
$ProdType = @ProductType
$CSD = val(right(@csd,1))
$HKLMSCCS = 'HKLM\SYSTEM\CurrentControlSet'
$HKCUSMWCV = 'HKCU\Software\Microsoft\Windows\CurrentVersion'
$HKLMSMWCV = 'HKLM\Software\Microsoft\Windows\CurrentVersion'
$HKLMSMWNTCV = 'HKLM\Software\Microsoft\Windows NT\CurrentVersion'
$HKCUSMWNTCV = 'HKCU\Software\Microsoft\Windows NT\CurrentVersion'
$HKLMSMWCVAP = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths'
$CommonAppData = readvalue($HKLMSMWCV+'\Explorer\Shell Folders', 'Common AppData')
$Desktop = readvalue($HKCUSMWCV+'\Explorer\Shell Folders','Desktop')
$StartMenu = readvalue($HKCUSMWCV+'\Explorer\Shell Folders','Start Menu')
$Favorites = readvalue($HKCUSMWCV+'\Explorer\Shell Folders','Favorites')
$AllDesktop = expandenvironmentvars(readvalue($HKLMSMWCV+'\Explorer\User Shell Folders','Common Desktop'))
$AllStartMenu = expandenvironmentvars(readvalue($HKLMSMWCV+'\Explorer\User Shell Folders','Common Start Menu'))
$Server = readvalue($HKLMSCCS+'\Control\ProductOptions', 'ProductType')
$Admin = iif(ingroup($HostName+'\'+sidtoname('S-1-5-32-544'))-1+@INWIN=1,'Yes','No')
$NoNAVFound = existkey('HKLM\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\Quarantine')
$CurrentIP = GetCurrentIP()
$CurrentOS = OSID()
$InstallDate = CTime($CurrentOS[9])
$FreeSpace = DiskSpace(,1)
$CPU = trim(@CPU)
$Mhz = formatnumber(val(@MHZ),0)
$Ram = formatnumber((memorysize()),0)
$ST = SystemType()
$SystemUpTime = Uptime()
$NAVInfo = GetNavAntiVirusInfo(,,1,1)
$IE = GetIEVersion()
$OfficeApps = GetOfficeDetails()
$SupportNumber = '123-555-555 Tie-Line: 4444-5555'
$MB='Help Desk Support Number : '+$SupportNumber+@CRLF
$MB=$MB+'**************************************************************************'+@CRLF
$MB=$MB+'[USER - INFORMATION] _____________________________________________'+@CRLF
$MB=$MB+'My User Logon ID '+$UserID+' ('+$FullName+')'+@CRLF
$MB=$MB+'Member of Local Admin Group ' +$Admin+@CRLF
$MB=$MB+'Maximum Password Age '+$MaxPWAge+' Days'+@CRLF
$MB=$MB+'Current Password Age '+$PWAge+' Days'+@CRLF
$MB=$MB+'Password Expires in '+$PassExpires+' Days'+@CRLF
$MB=$MB+'User Account Comment '+$UserComment+@CRLF
$MB=$MB+'Home Drive '+$HomeDrive+@CRLF
$MB=$MB+'Home Directory '+$HomeDirectory+@CRLF
$MB=$MB+'Logon Server '+$LogonServer+@CRLF
$MB=$MB+'[COMPUTER - INFORMATION] _____________________________________________'+@CRLF
$MB=$MB+'My Computer Name '+$HostName+@CRLF
$MB=$MB+'Computer Type ' +$ST[1]+@CRLF
$MB=$MB+'Computer is a member of ' +$DomainMemberOf+' Domain'+@CRLF
if $ADSite<>""$MB=$MB+'Computer AD Site Location ' +$ADSite+@CRLF endif
$MB=$MB+'Computer DNS Name '+$DNSHostName+@CRLF
$MB=$MB+'My Current IP Address '+$CurrentIP+@CRLF
$MB=$MB+'Network Card MAC Address '+$MacAdd+@CRLF
$MB=$MB+'Operating System '+$CurrentOS[12]
$MB=$MB+' (Service Pack '+$CurrentOS[3]+ ' )'+@CRLF
$MB=$MB+'Operating System Install Date '+$InstallDate+@CRLF
$MB=$MB+'CPU Type '+$CPU+@CRLF
$MB=$MB+'CPU Speed '+$Mhz+' Mhz'+@CRLF
$MB=$MB+'Memory Size '+$Ram+' MB'+@CRLF
$MB=$MB+'Drive Space on System Drive '+$FreeSpace+' MB'+@CRLF
$MB=$MB+'Computer Uptime ' +$SystemUpTime+@CRLF
$MB=$MB+'Current Workstation Time '+@DATE+' '+@TIME+@CRLF
$MB=$MB+'[MICROSOFT OFFICE] _____________________________________________'+@CRLF
$MB=$MB+'Access '+$OfficeApps[3]+@CRLF
$MB=$MB+'Excel '+$OfficeApps[0]+@CRLF
$MB=$MB+'Internet Explorer '+$IE[4]+@CRLF
$MB=$MB+'Outlook '+$OfficeApps[7]+@CRLF
$MB=$MB+'PowerPoint '+$OfficeApps[2]+@CRLF
$MB=$MB+'Project '+$OfficeApps[5]+@CRLF
$MB=$MB+'Publisher '+$OfficeApps[4]+@CRLF
$MB=$MB+'Visio '+$OfficeApps[6]+@CRLF
$MB=$MB+'Word '+$OfficeApps[1]+@CRLF+@CRLF
if not $NoNAVFound $MB=$MB+'Antivirus Def Date '+$NAVInfo[1]+@CRLF endif
if not $NoNAVFound $MB=$MB+'Age of Def Files '+$NAVInfo[8]+' Day(s) old'+@CRLF endif
if not $NoNAVFound $MB=$MB+'Symantec Antivirus Parent Server '+$NAVInfo[2] endif
$InfoMessageBox = MessageBox($MB,'My Computer Information',262208,0)
;********************************************
;******* User Defined Functions *************
;********************************************
function GetCurrentIP()
dim $IP, $TempFile, $Line, $cf
$TempFile = "%TEMP%\PING.TXT"
If exist($TempFile)
del $TempFile
endif
shell '%COMSPEC% /C PING -n 1 @WKSTA >'+$TempFile
$IP = ""
if open(1, $TempFile) = 0
$Line = readline(1)
while @ERROR = 0
if instr($Line,@WKSTA)
$Line = substr($Line,instr($Line,"[")+1)
$GetCurrentIP = substr($Line,1,instr($Line,"]")-1)
endif
$Line = readline(1)
loop
$cf = close(1)
endif
if exist($TempFile)
del $TempFile
endif
endfunction
;RETURNS array of thirteen identifiers
; OSID[0] full operating system description
; OSID[1] kernel description (Win9x, WinNT, Win2K, WinXP, Win2K3)
; OSID[2] operating system role (workstation, member server, domain controller)
; OSID[3] operating system service pack level
; OSID[4] operating system build level
; OSID[5] uni/multi-processor type
; OSID[6] registered owner
; OSID[7] registered organization
; OSID[8] Product key
; OSID[9] Install Date (use CTime() UDF to convert to date-time-string)
; OSID[10] OEM Duplicator string (can be set during SYSPREP unattended installs)
; OSID[11] OS Language
; OSID[12] @PRODUCTTYPE macro value (local and remote)
function osid(optional $sComp)
dim $osidarray[13]
dim $iINWIN, $sDOS, $iBUILD, $sCSD, $iPRODUCTSUITE, $sPRODUCTTYPE
dim $operating_system, $sp_level, $os_suite, $os_short, $productsuite
dim $os_type, $os_role, $os_flavor, $os_subver, $regkey
dim $os_build, $os_proc, $os_owner, $os_org, $os_key, $os_date, $os_oem
dim $os_lang, $os_producttype
$sComp=trim($sComp)
select
case $sComp=@WKSTA
$sComp=''
case $sComp and not keyexist('\\'+$sComp+'\HKLM')
exit 2
case $sComp
$sComp='\\'+$sComp+'\'
endselect
; fetch all macro info depending on whether it's remote or local
if $sComp
if keyexist($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList')
$iINWIN=1
$sDOS=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CurrentVersion')
$iBUILD=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CurrentBuildNumber')
$sCSD=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','CSDVersion')
if $sDOS='4.0' and readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009','Installed')
$sCSD=$sCSD+'a'
endif
$sPRODUCTTYPE=readvalue($sComp+'HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions','ProductType')
select
case $sPRODUCTTYPE='WinNT'
if $sDOS='4.0'
$sPRODUCTTYPE='Workstation'
else
$sPRODUCTTYPE='Professional'
endif
case $sPRODUCTTYPE='ServerNT'
if $sDOS='5.2'
$sPRODUCTTYPE=''
else
$sPRODUCTTYPE='Server'
endif
case $sPRODUCTTYPE='LANManNT'
$sPRODUCTTYPE='Domain Controller'
case 1
$sPRODUCTTYPE='Home Edition'
endselect
$sPRODUCTTYPE=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','ProductName')+' '+$sPRODUCTTYPE
$sPRODUCTTYPE=join(split($sPRODUCTTYPE,'Microsoft'),'')
$iPRODUCTSUITE=''
$os_lang=$sComp+join(split(readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','SystemRoot'),':\'),'$\')+'\system32\shell32.dll'
$os_lang=getfileversion($os_lang,'Language')
else
$iINWIN=2
$dDOS=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion','VersionNumber')
$dDOS=split($dDOS,'.')
$iBUILD=$dDOS[ubound($dDOS)]
redim preserve $dDOS[1]
$sDOS=join($dDOS,'.')
$sCSD=''
$iPRODUCTSUITE=''
$sPRODUCTTYPE=readvalue($sComp+'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion','Version')
$os_lang=right(''+readvalue($sComp+'HKLM\SYSTEM\CurrentControlSet\Control\Nls\Locale',''),4)
endif
else
$iINWIN=@INWIN
$sDOS=@DOS
$iBUILD=@BUILD
$sCSD=@CSD
$iPRODUCTSUITE=@PRODUCTSUITE
$sPRODUCTTYPE=@PRODUCTTYPE
$os_lang=@SYSLANG
endif
; set the correct registry key
if $iINWIN=1
$regkey='HKLM\Software\Microsoft\Windows NT\CurrentVersion'
else
$regkey='HKLM\Software\Microsoft\Windows\CurrentVersion'
endif
if $sComp
$regkey=$sComp+$regkey
endif
; retrieve registered owner, organization, build, type
$os_owner=readvalue($regkey,'RegisteredOwner')
$os_org=readvalue($regkey,'RegisteredOrganization')
$os_proc=readvalue($regkey,'CurrentType')
$os_build=val($iBUILD)
select
case $iINWIN=1
; determine the operating system kernel
select
Case $sDOS='6.0'
$operating_system='Windows Longhorn'
select
case $os_build=4015
$operating_system=$operating_system+' (Alpha Preview 3)'
case $os_build=4008
$operating_system=$operating_system+' (Alpha Preview 2)'
case 1
$operating_system=$operating_system+' (Alpha/Beta/RC)'
endselect
$os_short='WinLonghorn'
$os_key=readvalue($regkey,'ProductID')
Case $sDOS='5.2'
$operating_system='Windows Server 2003'
$os_short='Win2K3'
$os_key=readvalue($regkey,'ProductID')
select
case $os_build=3714
$operating_system=$operating_system+' (RC1)'
case $os_build<3790
$operating_system=$operating_system+' (Alpha/Beta/RC)'
endselect
Case $sDOS='5.1'
$operating_system='Windows XP'
select
case $os_build=2250
$operating_system=$operating_system+' (Alpha)'
case $os_build=2257
$operating_system=$operating_system+' (Alpha)'
case $os_build=2410
$operating_system=$operating_system+' (Beta 1)'
case $os_build=2416
$operating_system=$operating_system+' (Beta 1)'
case $os_build=2462
$operating_system=$operating_system+' (Beta 2)'
case $os_build=2465
$operating_system=$operating_system+' (Beta 2)'
case $os_build=2496
$operating_system=$operating_system+' (RC1)'
case $os_build=2505
$operating_system=$operating_system+' (RC1)'
case $os_build=2526
$operating_system=$operating_system+' (RC2)'
case $os_build=2542
$operating_system=$operating_system+' (RC3)'
endselect
$os_short='WinXP'
$os_key=readvalue($regkey,'ProductID')
Case $sDOS='5.0'
$operating_system='Windows 2000'
select
case $os_build=1515
$operating_system=$operating_system+' (Beta 2)'
case $os_build=2031
$operating_system=$operating_system+' (Beta 3)'
case $os_build=2128
$operating_system=$operating_system+' (Beta 3 RC2)'
case $os_build=2183
$operating_system=$operating_system+' (Beta 3)'
endselect
$os_short='Win2k'
$os_key=readvalue($regkey,'ProductID')
Case $sDOS='4.0'
$operating_system='Windows NT 4.0'
$os_short='WinNT'
$os_key=readvalue($regkey,'ProductID')
$os_key=left($os_key,5)+'-'+substr($os_key,6,3)+'-'+substr($os_key,10,7)+'-'+right($os_key,5)
Case 1
$operating_system='unknown'
$os_short='unknown'
endselect
; determine the service pack level
$sp_level=$sCSD
if instr($sp_level,'Service Pack')
$sp_level=split($sp_level,'Service Pack')
$sp_level=trim($sp_level[ubound($sp_level)])
else
$sp_level=0
endif
; determine the product suite
$productsuite=val($iPRODUCTSUITE)
$os_suite=''
if $productsuite
if $productsuite & 1
$os_suite=$os_suite+'Small Business |'
endif
if $productsuite & 2
$os_suite=$os_suite+'Enterprise |'
endif
if $productsuite & 4
$os_suite=$os_suite+'BackOffice |'
endif
if $productsuite & 8
$os_suite=$os_suite+'Communication Server |'
endif
if $productsuite & 16
$os_suite=$os_suite+'Terminal Server |'
endif
if $productsuite & 32
$os_suite=$os_suite+'Small Business (Restricted) |'
endif
if $productsuite & 64
$os_suite=$os_suite+'Embedded NT |'
endif
if $productsuite & 128
$os_suite=$os_suite+'DataCenter |'
endif
if $productsuite & 256
$os_suite=$os_suite+'Single User Terminal Server |'
endif
if $productsuite & 512
$os_suite=$os_suite+'Home Edition |'
endif
if $productsuite & 1024
$os_suite=$os_suite+'Blade Server |'
endif
if instr($os_suite,'|')
$os_suite=left($os_suite,len($os_suite)-2)
endif
endif
; determine the producy type
$os_type=$sPRODUCTTYPE
select
Case instr($os_type,'Domain Controller')
$os_type='Domain Controller'
$os_role='Domain Controller'
$os_flavor='Server'
Case instr($os_type,'Server')
$os_type='Server'
$os_role='Member Server'
$os_flavor='Server'
Case instr($os_type,'Workstation')
$os_type='Workstation'
$os_role='Workstation'
$os_flavor='Workstation'
case instr($os_type,'Professional')
$os_type='Professional'
$os_role='Workstation'
$os_flavor='Workstation'
Case instr($os_type,'Tablet PC')
$os_type='Tablet PC'
$os_role='Workstation'
$os_flavor='Tablet PC'
Case instr($os_type,'Home Edition')
$os_type='Home Edition'
$os_role='Workstation'
$os_flavor='Workstation'
case 1
$os_type='unknown'
$os_role='unknown'
$os_flavor='unknown'
endselect
; create the @PRODUCTTYPE macro
$os_producttype=join(split($operating_system+' '+$os_type,'4.0 '),'')
$operating_system=$os_producttype+' Service Pack '+$sp_level
if $os_suite<>''
$operating_system=$operating_system+' ['+$os_suite+']'
endif
; determine the installation date
$os_date=readvalue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion','Installdate')
; determine the OEM Duplicator String
$os_oem=readvalue('HKLM\System\Setup','OemDuplicatorString')
Case $iINWIN=2
$os_short='Win9x'
$os_role='Workstation'
$sp_level=0
$os_subver=lcase(ReadValue($regkey,'SubVersionNumber'))
select
Case $sDOS='4.90'
$operating_system='Windows ME'
$os_key=readvalue($regkey,'ProductKey')
$os_flavor=''
Case $sDOS='4.10'
$operating_system='Windows 98'
$os_key=readvalue($regkey,'ProductKey')
select
Case instr($os_subver,'c')
$os_flavor='SE'
case instr($os_subver,'b')
$os_flavor='B'
case $os_subver=' a '
$os_flavor='Second Edition'
Case 1
$os_flavor='OEM'
endselect
case $sDOS='4.0'
$operating_system='Windows 95'
$os_key=readvalue($regkey,'ProductID')
select
Case instr($os_subver,'c')
$os_flavor='OSR 2.5'
case instr($os_subver,'b')
$os_flavor='OSR 2.0'
case instr($os_subver,'a')
$os_flavor=' Service Pack 1'
Case 1
$os_flavor=' OEM'
endselect
Case 1
$operating_system='unknown'
$os_short='unknown'
endselect
$os_producttype=$operating_system
if $os_flavor
$operating_system=$operating_system+' '+$os_flavor
endif
endselect
$osidarray[0]=$operating_system
$osidarray[1]=$os_short
$osidarray[2]=$os_role
$osidarray[3]=$sp_level
$osidarray[4]=$os_build
$osidarray[5]=$os_proc
$osidarray[6]=$os_owner
$osidarray[7]=$os_org
$osidarray[8]=$os_key
$osidarray[9]=$os_date
$osidarray[10]=$os_oem
$osidarray[11]=$os_lang
$osidarray[12]=$os_producttype
$osid=$osidarray
endfunction
;SYNTAX DISKSPACE([DRIVE, FORMAT])
;PARAMETERS DRIVE
; optional driveletter, directory, or UNC (defaults to system drive)
; FORMAT
; optional parameter indicating the units to be used when returning the
; available disk space
; 0 = KB (KiloByte, default)
; 1 = MB (MegaByte)
; 2 = GB (GigaByte)
; 3 = TB (TeraByte)
; 4 = PB (PetaByte)
; 5 = % (percentage total diskspace, does not support UNCs)
function diskspace(optional $drive, optional $format)
dim $objWMIService, $sWQL, $colDrives, $objDrive
if not $drive
$drive='%WINDIR%'
endif
$format=val
|