Hi,

I am a new to msi script. I am facing a problem. I need to check whether a file exists or not and accordingly needs to update/increment the registry value while installating a product. Can anyone please share a piece of code(script) to find the list of file and accordingly check whehter files exists or not. If exists then update the registry value. The same thing applies to uninstall. i need to check whether file exists or not and accordingly decrement the registry value. if registry value is '0' then delete the file.

Thanks in advance,


/Sudhi
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
The following code may be useful to you.
The first time you install an application it creates an entry in the registry.
When you go to reinstall the same application an incremental count is created.
The same code can be used for application uninstalls.
Note: replace MYAPPS with a name more useful to you.

Good Lucj
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Function Get_ApplicationReg()
On Error Resume Next
Dim tmp
Get_ApplicationInstalled = False
tmp = oShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MYAPPS\Installed Applications\" & sfTitle & "\Installed")
If tmp = "True" Then
Get_ApplicationReg = True
End If
End Function
Sub Set_ApplicationReg()
On Error Resume Next
Dim Count
Select Case bApplicationInstalled
Case False
Call oShell.RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\MYAPPS\Installed Applications\" & sfTitle & "\Installed", "True", "REG_SZ")
Case True
Count = oShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MYAPPS\Installed Applications\" & sfTitle & "\ReinstallCount")
Count = Count + 1
Call oShell.RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\MYAPPS\Installed Applications\" & sfTitle & "\ReinstallCount", Count, "REG_SZ")
End Select
End Sub

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
Answered 08/12/2008 by: supergrid
Yellow Belt

Please log in to comment
0
Go to http://www.devguru.com/technologies/vbscript/home.asp. Search for 'FileSystemObject'. In there you'll find 'FileExists' and 'FolderExists' methods and some rather sparse sample code. For more code examples of actually using those methods, try http://www.computerperformance.co.uk/vbscript/index.htm
Answered 08/26/2008 by: VBScab
Red Belt

Please log in to comment
0
You can also use MSI functionality to minimize VBS scripting if you want.
System Search allows you to search for files/reg/ini settings and extract search result into an MSI property; you can set conditions based on the property values if you'd like to perform some action...
Answered 09/09/2008 by: revizor
Third Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity