cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ktbrownusa
Level 3

Quick delete of previous installs file maked Permanent

In a previous install a file was marked as Permanent.
I would like to delete the file and put a new one in it's place during a full major update MSI installation.
I was thinking about creating a CA to do this, but was working where I'd place it or if there is another way.
Any suggestions?

Kevin
Labels (1)
0 Kudos
(1) Reply
ktbrownusa
Level 3

ktbrownusa wrote:
In a previous install a file was marked as Permanent.
I would like to delete the file and put a new one in it's place during a full major update MSI installation.
I was thinking about creating a CA to do this, but was working where I'd place it or if there is another way.
Any suggestions?

Kevin


I created a CA that runs after Unpublish Features. This way the full uninstall has been completed if this is a major uninstall.
I put in the conditions REMOVE <> "ALL" so it doesn't run at the uninstall, just for the Install.

Sychronous
Immediate execution
Always Execute

Script as follows:

'This routine finds the permanent file and removes it by backing it up.
'Then the install will place the new file

Dim fso, FileConfig

FileConfig = "TheActualFileName"

DataDir = Session.Property("CommonAppDataFolder") & "Company\DataDirectory\"

On error resume next

Set fso = CreateObject("Scripting.FileSystemObject")

'If we haven't updated the the file to new one

'This is only for this move. If the back up exsits, we do not need to do it again

'MsgBox DataDir & FileConfig & "_Backup " & "|" & DataDir & FileConfig

If Not fso.FileExists (DataDir & FileConfig & "_Backup") then

fso.MoveFile DataDir & FileConfig, DataDir & FileConfig & "_Backup"

End If
0 Kudos