Re: querying an array by Torsten
Torsten
Fri Dec 07 23:50:26 PST 2007
Hello Kai,
jepp, that works. Meanwhile I found another quit similar way:
For Each sSubkey In aSubkeys
oReg.GetStringValue HKLM, sUninstallPath & "\" & sSubkey, "DisplayName", sAppName
Select Case sAppName
Case "name of the software"
counter = counter + 1
End Select
Next
If counter < 1 Then
'action: "software has to be installed"
Else
'action: "software is installed"
End If
Thank You
Torsten
Kai.Bluesky wrote:
> Dear Torsten,
>
> SoftwareInstalled = 0
>
> For Each sSubkey In aSubkeys
> oReg.GetStringValue HKLM, sUninstallPath & "\" & sSubkey,
> "DisplayName", sAppName
> if sAppName = "taget software" then
> SoftwareInstalled = 1
> End if
> Next
>
> if SoftwareInstalled =1 then
> WScript.Echo sAppName & "Installed"
> else
> WScript.Echo sAppName & "not Install"
> end if
>
>
> Hope it may Help.
>
> Best Regrads,
> Kai
>
>
> On Dec 6, 5:13 pm, Torsten Koehler <torsten_koeh...@yahoo.com> wrote:
>> Hi all,
>>
>> a registry query like this works fine getting all software installed on a pc:
>>
>> -----------------------------------------
>> Const HKCR = &H80000000
>> Const HKCU = &H80000001
>> Const HKLM = &H80000002
>>
>> Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
>> ".\root\default:StdRegProv")
>>
>> sUninstallPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
>>
>> oReg.EnumKey HKLM, sUninstallPath, aSubkeys
>>
>> On Error Resume Next
>> For Each sSubkey In aSubkeys
>> oReg.GetStringValue HKLM, sUninstallPath & "\" & sSubkey, "DisplayName",
>> sAppName
>> WScript.Echo sAppName
>> Next
>> -----------------------------------------
>>
>> But how can i query this array for a specific software wether it is
>> installed or not and as a result of that a task will be done.
>>
>> Thanks in advance for your help
>>
>> Torsten
>