/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (13)

Posted by: wiseapp 18 years ago
Second Degree Green Belt
0
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
Posted by: WesternPower 18 years ago
Senior Yellow Belt
0
Morning WiseApp,

Thanks for that. I was trying to avoid scripting if I could. I thought there might have been someway that the MSI/MST files could be configured to delete the files. If I can't find a way, then I'll use you're scripting method.

Thanks again for the help I appreciate it.

Lance
Posted by: plangton 18 years ago
Second Degree Blue Belt
0
Hey Lance,

There is a way, populate the RemoveFiles and RemoveRegistry tables - its a touch tedious but it should work. You can actually snapshot file and registry deletions (in Installshield AdminStudio at least, so I assume Wise can as well) but its not enabled by default.

Rgds

Paul
Posted by: WesternPower 18 years ago
Senior Yellow Belt
0
G'day Paul,

We're using AdminStudio. I thought there was a way to delete the file using the tables but I'm not sure how. I kind of get the gist of it but it doesn't seem to want to work for me. That's the information I'm looking for.

Thanks

Lance
Posted by: plangton 18 years ago
Second Degree Blue Belt
0
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
Posted by: WesternPower 18 years ago
Senior Yellow Belt
0
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
Posted by: plangton 18 years ago
Second Degree Blue Belt
0
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
Posted by: WesternPower 18 years ago
Senior Yellow Belt
0
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
Posted by: wiseapp 18 years ago
Second Degree Green Belt
0
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.
Posted by: plangton 18 years ago
Second Degree Blue Belt
0
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
Posted by: wiseapp 18 years ago
Second Degree Green Belt
0
G'day Paul,

I agree with you Paul but don't you think that putting just a VBScript will save much of your time where in you don;t have to include each and every file in the component table. You can embedd the vbscript within your MSI and won;t take much of your time. What do you think?
Posted by: WesternPower 18 years ago
Senior Yellow Belt
0
Morning Bhupesh,

I agree scripting may have been easier, however this has been a great opportunity to learn about MSI/MST's and it's also been years since I've done any scripting.


Thanks
Lance
Posted by: wiseapp 18 years ago
Second Degree Green Belt
0
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ