Deleting files using MSI/MST
Morning, I'll start off by saying that I'm very new to the world of MSI. I'm more used to using snapshot in Zenworks.
Anyway here’s the scenario, currently we have adobe reader 6 installed with some 3rd party plug ins. These plug ins reside in the C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins directory.
We are in the process of deploying adobe reader 7. A package has been created that removes adobe reader 6 and installs adobe reader 7 along with the 3rd party plug ins. The plug ins are installed into the C:\Program Files\adobe\acrobat 7.0\Reader\plug_ins directory.
However the package does not remove the 3rd party plug in files from the C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins directory or in fact remove the directory.
I have read the post that brenthunter2005 posted on the subject and that helped my understanding of the issue, but this has still got me stumped. Any help would be greatly appreciated.
Thanks
Lance
Anyway here’s the scenario, currently we have adobe reader 6 installed with some 3rd party plug ins. These plug ins reside in the C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins directory.
We are in the process of deploying adobe reader 7. A package has been created that removes adobe reader 6 and installs adobe reader 7 along with the 3rd party plug ins. The plug ins are installed into the C:\Program Files\adobe\acrobat 7.0\Reader\plug_ins directory.
However the package does not remove the 3rd party plug in files from the C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins directory or in fact remove the directory.
I have read the post that brenthunter2005 posted on the subject and that helped my understanding of the issue, but this has still got me stumped. Any help would be greatly appreciated.
Thanks
Lance
0 Comments
[ + ] Show comments
Answers (13)
Please log in to answer
Posted by:
wiseapp
19 years ago
Hi Western:
Assuming you are using wise, I would suggest to write a Wise Script that shall delete this directory and you can easily incooperate the same in your package or you could write a VB Script that will do the said. The sample vbscript is right here, do let me know in case you require more help.
Option Explicit
Dim objFSO
Dim objFolder
Dim objTargetFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Test")
Set objTargetFolder = objFSO.GetFolder("C:\Test")
ObjTargetFolder.Delete True
Assuming you are using wise, I would suggest to write a Wise Script that shall delete this directory and you can easily incooperate the same in your package or you could write a VB Script that will do the said. The sample vbscript is right here, do let me know in case you require more help.
Option Explicit
Dim objFSO
Dim objFolder
Dim objTargetFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Test")
Set objTargetFolder = objFSO.GetFolder("C:\Test")
ObjTargetFolder.Delete True
Posted by:
WesternPower
19 years ago
Posted by:
plangton
19 years ago
Posted by:
WesternPower
19 years ago
Posted by:
plangton
19 years ago
The following is an example of an entry in the RemoveFile table:
ASFCHOP.OCX RemoveFile_Component ASFCHOP.OCX OFFICE 3
From the SDK:
FileKey Primary key used to identify this particular table entry.
Component_
External key the first column of the Component table. This field references the component that controls the file to be removed.
FileName
This column contains the localizable name of the file to be removed. If this column is null, then the specified folder will be removed if it is empty. All of the files that match the wildcard will be removed from the specified directory.
DirProperty
Name of a property whose value is assumed to resolve to the full path to the folder of the file to be removed. The property can be the name of a directory in the Directory table, a property set by the AppSearch table, or any other property that represents a full path.
InstallMode
Must be one of the following values:
1 = Remove only when the associated component is being installed (msiInstallStateLocal or msiInstallStateSource).
2 = Remove only when the associated component is being removed (msiInstallStateAbsent).
3 = Remove in either of the above cases.
I got a lot of this info by going to the RemoveFile table in DirectEditor of Installshield and pressing F1.
Hope thats helped
Rgds
Paul
ASFCHOP.OCX
From the SDK:
FileKey Primary key used to identify this particular table entry.
Component_
External key the first column of the Component table. This field references the component that controls the file to be removed.
FileName
This column contains the localizable name of the file to be removed. If this column is null, then the specified folder will be removed if it is empty. All of the files that match the wildcard will be removed from the specified directory.
DirProperty
Name of a property whose value is assumed to resolve to the full path to the folder of the file to be removed. The property can be the name of a directory in the Directory table, a property set by the AppSearch table, or any other property that represents a full path.
InstallMode
Must be one of the following values:
1 = Remove only when the associated component is being installed (msiInstallStateLocal or msiInstallStateSource).
2 = Remove only when the associated component is being removed (msiInstallStateAbsent).
3 = Remove in either of the above cases.
I got a lot of this info by going to the RemoveFile table in DirectEditor of Installshield and pressing F1.
Hope thats helped
Rgds
Paul
Posted by:
WesternPower
19 years ago
G'day Paul,
Thanks for your prompt reply. I found all that when I was going through the help files and I kind of understand it. But there's something I'm sort of missing. And maybe something is getting lost in the translation.
Am I right in saying that the "component_" is a file that was placed on the PC by the MSI/MST? In my mind it must be to have an entry in the component table. I'm prepared to be wrong here (and I hope I am).
The file(s) I'm trying to remove were put on the PC some time ago by a different deployment method and so don't have an entry in the component table. The same goes for the directory that the files sit in. The directory needs an entry in the directory table.
Does that make sense?
Thanks again for your help & assistance.
Lance
Thanks for your prompt reply. I found all that when I was going through the help files and I kind of understand it. But there's something I'm sort of missing. And maybe something is getting lost in the translation.
Am I right in saying that the "component_" is a file that was placed on the PC by the MSI/MST? In my mind it must be to have an entry in the component table. I'm prepared to be wrong here (and I hope I am).
The file(s) I'm trying to remove were put on the PC some time ago by a different deployment method and so don't have an entry in the component table. The same goes for the directory that the files sit in. The directory needs an entry in the directory table.
Does that make sense?
Thanks again for your help & assistance.
Lance
Posted by:
plangton
19 years ago
Gudday,
The Component field needs to be the name of a component... the same way that a file has to be part of a component, the removefile entry has to belong to one too - you can create an empty one (in my example, the RemoveFile_Component component has nothing in it other than the RemoveFile entry).
So in your example, create a new component called RemoveFile_Component (for example), make sure the DirProperty you specify is either in the Directory table or is a property that represents a full path, and you should be right to rock and roll.
You an Aussie WesternPower? Whereabouts in the Lucky Country are ya?
Hope thats helped
Rgds
Paul
The Component field needs to be the name of a component... the same way that a file has to be part of a component, the removefile entry has to belong to one too - you can create an empty one (in my example, the RemoveFile_Component component has nothing in it other than the RemoveFile entry).
So in your example, create a new component called RemoveFile_Component (for example), make sure the DirProperty you specify is either in the Directory table or is a property that represents a full path, and you should be right to rock and roll.
You an Aussie WesternPower? Whereabouts in the Lucky Country are ya?
Hope thats helped
Rgds
Paul
Posted by:
WesternPower
19 years ago
G'day Paul,
It's all beginning to make sense and fall into my thick head. :-)
I'll have another look at it on Monday with a clear head. I didn't realise that I could define a comonent that wasn't part of the MSI/MST if that makes sense.
I think I got the DirProperty ok, but I have to be very careful as
C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins is very similar to
C:\Program Files\adobe\acrobat 7.0\Reader\plug_ins and I'm not too sure how adminstudio handles long file names, well file names with a space in them anyway.
Yeah, an Aussie here. I'm a Perth boy.
Thanks
Lance
It's all beginning to make sense and fall into my thick head. :-)
I'll have another look at it on Monday with a clear head. I didn't realise that I could define a comonent that wasn't part of the MSI/MST if that makes sense.
I think I got the DirProperty ok, but I have to be very careful as
C:\Program Files\adobe\acrobat 6.0\Reader\plug_ins is very similar to
C:\Program Files\adobe\acrobat 7.0\Reader\plug_ins and I'm not too sure how adminstudio handles long file names, well file names with a space in them anyway.
Yeah, an Aussie here. I'm a Perth boy.
Thanks
Lance
Posted by:
wiseapp
19 years ago
Hi Western Power:
I believe you are talking about RemoveFiles table here and I believe that table is used to remove only those files which are under component table, so I think Lance has to add all the adobe 6/0 plugins in order to come under component table. I belive Lance is talking about removing the whole directory instead of few files. As RemoveFiles table will not work till the time there is an entry of the corresponding component in the components table, I believe I am making myself clear on the same. Lance should you require any further help keep me posted.
I believe you are talking about RemoveFiles table here and I believe that table is used to remove only those files which are under component table, so I think Lance has to add all the adobe 6/0 plugins in order to come under component table. I belive Lance is talking about removing the whole directory instead of few files. As RemoveFiles table will not work till the time there is an entry of the corresponding component in the components table, I believe I am making myself clear on the same. Lance should you require any further help keep me posted.
Posted by:
plangton
19 years ago
Hi WIseApp,
I'm not sure I follow what you mean here. I've created an MSI that doesn't do anything other than remove 2 files - these are part of a component called RemoveFile_Component. The files do not appear anywhere else in the package. When the RemoveFiles action takes place, these files get removed. So yes you will have to add the files and folder individually but if you don't want to use a custom action then its really the only way (that I know of anyway!)
Rgds
Paul
I'm not sure I follow what you mean here. I've created an MSI that doesn't do anything other than remove 2 files - these are part of a component called RemoveFile_Component. The files do not appear anywhere else in the package. When the RemoveFiles action takes place, these files get removed. So yes you will have to add the files and folder individually but if you don't want to use a custom action then its really the only way (that I know of anyway!)
Rgds
Paul
Posted by:
wiseapp
19 years ago
Posted by:
WesternPower
19 years ago
Posted by:
wiseapp
19 years ago
G'day Lance:
In case you want a vbscript to do this task, just take a look above on the posts , I have already pasted a vbscript that will delete a directory c:\test(you can change this to anything that you want). Still you require help do let me know here is a sample script again for a ready reference.
Option Explicit
Dim objFSO
Dim objFolder
Dim objTargetFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Test") 'this can be c:\program Files\Adobe\plugins
Set objTargetFolder = objFSO.GetFolder("C:\Test") 'same path here
ObjTargetFolder.Delete True
you can include this vbscript in your MSI , just double click on custom action that says call vbscript from embedded code and paste the above code and then put a if statement , that will call this script only when your MSI would be installing the stuff , so this is going to be
if Not Installed
CallVbScript from embedded code
end
this is how your final script in User Interface should look like (in case you want to remove the directory before installing your new files).
I hope this would answer your doubts, in case your require any clarifications regarding the same kindly revert back.
In case you want a vbscript to do this task, just take a look above on the posts , I have already pasted a vbscript that will delete a directory c:\test(you can change this to anything that you want). Still you require help do let me know here is a sample script again for a ready reference.
Option Explicit
Dim objFSO
Dim objFolder
Dim objTargetFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Test") 'this can be c:\program Files\Adobe\plugins
Set objTargetFolder = objFSO.GetFolder("C:\Test") 'same path here
ObjTargetFolder.Delete True
you can include this vbscript in your MSI , just double click on custom action that says call vbscript from embedded code and paste the above code and then put a if statement , that will call this script only when your MSI would be installing the stuff , so this is going to be
if Not Installed
CallVbScript from embedded code
end
this is how your final script in User Interface should look like (in case you want to remove the directory before installing your new files).
I hope this would answer your doubts, in case your require any clarifications regarding the same kindly revert back.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.