Thursday, May 1, 2014

Checking for 64 bit Product code in registry

On Error Resume Next

strComputer = "."
StrApp1=""
StrApp2=""
i=0
Dim arr()
ReDim arr(10)

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("SELECT * FROM Win32_Product")   

ReDim preserve arr(colSoftware.Count)

If colSoftware.Count > 0 Then
 For Each objSoftware in colSoftware
arr(i)=objsoftware.IdentifyingNumber
i=i+1
 Next
End If

For i=0 to ubound(arr)

 If arr(i)="{73B67D46-99DB-40C8-9E76-9F770C519257}" then
SetVariable"HARVERSION", arr(i)
StrApp1=arr(i)
End if

 If arr(i)="{F47F0F22-81F1-46E7-A4D2-9E2E41CE2F21}" then
SetVariable"HARVERSION1", arr(i)
StrApp2=arr(i)
 End If
Next

No comments:

Post a Comment