|
|
|
| 25 March 2002 | GetSoftwareList() |
| Author | ScriptLogic Corporation |
| Action | Return and array consisting of the software programs installed on the client. |
| Syntax | GetSoftwareList (sort) |
| Parameters | |
| Remarks | Good tool for performing a software inventory during logon. |
| Returns | Returns an array of the software programs installed on the client. |
| Dependencies | Asort() |
| Examples | ?'The following applications are installed on this computer:' $InstalledSoftwareArray=GetSoftwareList(1) FOR EACH $element IN $InstalledSoftwareArray ?$element NEXT |
| Source |
FUNCTION GetSoftwareList (OPTIONAL $sort)
; Author: ScriptLogic Corporation
; Last revised: 16-nov-2001
; Optional parameter: sort
; if 0 (or not supplied), no sorting of list is done.
; if 1, results are sorted alphabetically, ascending order
;
; Note: If sorting is requested, this function then has a dependency on the Asort() UDF.
DIM $arrayindex, $enumindex, $component, $dn, $regkey, $swarray[200]
$regkey='HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall'
$enumindex=0
$arrayindex=0
:gisloop
$component=EnumKey($regkey, $enumindex)
IF NOT @error
IF NOT (Len($component)=7 AND Left($component,1)='Q')
; above line excludes hotfixes from listing
IF NOT (0+ReadValue($regkey+'\'+$component,'SystemComponent'))
$dn=ReadValue($regkey+'\'+$component,'DisplayName')
IF $dn
$swarray[$arrayindex]=$dn
$arrayindex=$arrayindex+1
ENDIF
ENDIF
$enumindex=$enumindex+1
GOTO gisloop
ENDIF
ENDIF
REDIM PRESERVE $swarray[$arrayindex]
IF $sort
$getsoftwarelist=asort($swarray)
ELSE
$getsoftwarelist=$swarray
ENDIF
ENDFUNCTION ; - GetSoftwareList -
|
|
|
|