Hi,
I have to update a file in the profiles folder and delete another file in a folder in the windows folder.

With my package (a mst) i cant update/replace the profilefolder file, but I can delete it and install the new one with the correct setting. Fine.

In the windows folder I cant delete the file but instead I can replce it if I install another. I just had test to see if I could replace it (sine I could not replce the file in the profiles folder), i really want to remove it since it messes things up with the new version of the application I'm installing.

Below you can see the code from the wise-script I created to do these things, you can also se the files that messes with my head right now. The code for the file in profilesfolder work but not for the other file. But if i run this outside the mst it works fine even for the windows folder file! Any ideas?

Oh, and I tried to remove it during install as a RemoveFile also. Did not work.

I'm using Wise Package Studio.


Get Windows Installer Property ProfilesFolder into PROFILE
Delete File(s) %PROFILE%\ApplicationData\Macromedia\Flashplayer\macromedia.com\support\flashplayer\sys\
settings.sol
Delete File(s) %SYS32%\Macromed\Flash\mms.cfg
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
I tried an embedded vb-script aswell. I'm not the greatest at vb but i found and modified a script that works outside the mst. Embedded in the mst, it does not work..


Dim filesys, mmsfile
set filesys = CreateObject ("Scripting.FileSystemObject")
Set mmsfile = filesys.GetFile("C:\WINDOWS\system32\Macromed\Flash\mms.cfg")
mmsfile.Delete


I'm executing the scripts in Execute Deffered before InstallFiles
I have also tried removing the file just before InstallFinalize.

And I know the scripts are being run since I wrote put a progress bar text.
Answered 12/16/2009 by: polkagris
Orange Belt

Please log in to comment
2
Try placing the following script

Dim WinDir
Set objWshShell = CreateObject("Wscript.Shell")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")

WinDir=objWshShell.ExpandEnvironmentStrings("%windir%")

If objFileSystemObject.FileExists(WinDir & "\XYZ.abc") then
objFileSystemObject.DeleteFile(WinDir & "\XYZ.abc")
End If
Answered 12/16/2009 by: mekaywe
Brown Belt

Please log in to comment
0
Have you tried using the "RemoveFile" table in MSI.?


http://msdn.microsoft.com/en-gb/library/aa371201(VS.85).aspx
Answered 12/16/2009 by: t_claydon
Senior Yellow Belt

Please log in to comment
0
Have you tried using the "RemoveFile" table in MSI.?
Oh, and I tried to remove it during install as a RemoveFile also. Did not work.
@OP, when you say the script "didn't work", did it not run or simply not delete the file? Of course, RemoveFile is the correct method to use. I can only think that it failed if the file were in use when the RemoveFiles action ran. What did the log (which of course you took when testing) tell you?
Answered 12/16/2009 by: VBScab
Red Belt

Please log in to comment
0
ORIGINAL: VBScab

Have you tried using the "RemoveFile" table in MSI.?
Oh, and I tried to remove it during install as a RemoveFile also. Did not work.
@OP, when you say the script "didn't work", did it not run or simply not delete the file? Of course, RemoveFile is the correct method to use. I can only think that it failed if the file were in use when the RemoveFiles action ran. What did the log (which of course you took when testing) tell you?



Or the account that is running the MSI doesn't have the correct permissions?
Answered 12/16/2009 by: t_claydon
Senior Yellow Belt

Please log in to comment
0
ORIGINAL: VBScab
@OP, when you say the script "didn't work", did it not run or simply not delete the file? Of course, RemoveFile is the correct method to use. I can only think that it failed if the file were in use when the RemoveFiles action ran. What did the log (which of course you took when testing) tell you?


The log (removeOldSettings is my Custom Action):

MSI (s) (C0:54) [13:56:17:640]: Doing action: removeOldSettings
Action ended 13:56:17: CreateFolders. Return value 1.
MSI (s) (C0:54) [13:56:17:640]: Transforming table CustomAction.
MSI (s) (C0:54) [13:56:17:640]: Transforming table Binary.
Action start 13:56:17: removeOldSettings.
MSI (s) (C0:54) [13:56:17:640]: Doing action: MoveFiles
Action ended 13:56:17: removeOldSettings. Return value 1.

MSI (s) (C0:54) [13:56:17:750]: Executing op: ActionStart(Name=removeOldSettings,Description=Removing old settings,)
MSI (s) (C0:54) [13:56:17:750]: Executing op: CustomActionSchedule(Action=removeOldSettings,ActionType=3137,Source=BinaryData,Target=g0,)


Above is the wise-script replacing settings.sol inprofiles folder, also trying to remove mms.cfg
Belov is the vb-script trying to delete just before InstallFinalize

MSI (s) (C0:54) [13:56:23:875]: Executing op: ActionStart(Name=remove_mms_cfg,,)
MSI (s) (C0:54) [13:56:23:875]: Executing op: CustomActionSchedule(Action=remove_mms_cfg,ActionType=3174,Source=Dim WinDir
Set objWshShell = CreateObject("Wscript.Shell")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
WinDir=objWshShell.ExpandEnvironmentStrings("%windir%")
If objFileSystemObject.FileExists(WinDir & "\system32\Macromed\Flash\mms.cfg") Then
objFileSystemObject.DeleteFile(WinDir & "\system32\Macromed\Flash\mms.cfg")
End If
,,)


I wrote a progressbar text aswell that shows upp, so I guess that tells me the scripts is running?

Well, after replacing my vb-script with mekaywes, it works. A little bit odd since it all worked outside the mst. My custom action and my modified vb-script still wont delete mms.cfg when embedded in the mst.

I can also add that my first modified vb-script returned simular rows in the log without noticable errors.

ORIGINAL: mekaywe

Try placing the following script

Dim WinDir
Set objWshShell = CreateObject("Wscript.Shell")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")

WinDir=objWshShell.ExpandEnvironmentStrings("%windir%")

If objFileSystemObject.FileExists(WinDir & "\XYZ.abc") then
objFileSystemObject.DeleteFile(WinDir & "\XYZ.abc")
End If


I replaced my script with this:

Dim WinDir
Set objWshShell = CreateObject("Wscript.Shell")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
WinDir=objWshShell.ExpandEnvironmentStrings("%windir%")
If objFileSystemObject.FileExists(WinDir & "\system32\Macromed\Flash\mms.cfg") Then
objFileSystemObject.DeleteFile(WinDir & "\system32\Macromed\Flash\mms.cfg")
End If



It still would be nice to figure out why it did not work before mekaywes "lifesaver". [;)]

That file should not be in use. In this case I am copying it to my disk on a clean windows installation (vm-ware image) , just before installing my app.
Answered 12/16/2009 by: polkagris
Orange Belt

Please log in to comment
2
D'oh! Easy, now that I look at your original in detail and actually think about it! :)

You were setting the file as an object:Set mmsfile = filesys.GetFile("C:\WINDOWS\system32\Macromed\Flash\mms.cfg")mmsfile.DeleteThe system is going to assign a "handle" of some description to the file and mark it as "in use" because of that.
Answered 12/16/2009 by: VBScab
Red Belt

Please log in to comment
0
Ah, ok. I would never have figured that out. VB-script isnt my cup off tea. :)

Well, still puzzled why it did not work before with the custom action - before I troubled myself with vb-scripts.
Guess I just have to settle with that it works, not why it did not work. [;)]

Many thanks to you all!
Answered 12/16/2009 by: polkagris
Orange Belt

Please log in to comment
1
ORIGINAL: VBScab

Have you tried using the "RemoveFile" table in MSI.?
Oh, and I tried to remove it during install as a RemoveFile also. Did not work.
Of course, RemoveFile is the correct method to use. I can only think that it failed if the file were in use when the RemoveFiles action ran. What did the log (which of course you took when testing) tell you?


The secret of why the file isn't removed while using the RemoveFile table is due to the missing (standard) RemoveFiles action.

I just did Adobe Flash Player 10.0.42.34 and hit the same nail :)

If anyone cares, here is my steps

Application Details
============================================================================================
Application Name : Flash Player
Application Version : 10.0.42.34
Application Vendor : Adobe


Package Notes
============================================================================================
The vendor MSI can be downloaded from the location specified as the "URL: Download Adobe Flash Player" reference.
(note: select the MSI Installer for "Internet Explorer" instead of "Plugin-based browsers")

Make sure to apply for the "Player Distribution License Agreement" before usage (see the "URL: Adobe Player Licensing" reference)


Package creation
============================================================================================
Vendor MSI customization
* Defining the common global security & privacy settings
(see the "URL: Adobe Flash Player Administration Guide for Flash Player 10" reference for more details)
- Create a file with the name "mms.cfg" and add the below content.
(note: make sure to save the file as UTF-8 encoded)
# Common global security & privacy settings

# Update options
# - Prevent Flash Player from automatically checking for and installing updated versions
AutoUpdateDisable = yes

# Privacy options
# - Prevent SWF files from accessing webcams or microphones
AVHardwareDisable = yes

# Security options
# - <add any preferred security option>

* Create a transform for the MSI with the following changes:
* Add the previously created configuration file
- Add the missing MsiFileHash & RemoveFile tables and their related _Validation table
entries (see the "Database table definition" reference for instructions).
- Add the mms.cfg file and make sure to install it under the "C:\WINDOWS\system32\
Macromed\Flash" folder (hint: use the existing INSTALLDIR directory).
- Add the mms.cfg to the RemoveFile table so it is removed during install as we want
to ensure we apply "our" latest settings if an existing mms.cfg file should exist.

* Add support for removing the above configuration file
As the (standard) RemoveFiles action is missing from the vendor MSI the mms.cfg will
not be removed during uninstall. To support this standard Windows Installer behaviour
we need to add this action.
- Add the RemoveFiles action to the InstallExecuteSequence table,
set the sequence value so the action is execution right before the RemoveFolders
action.

* Remove the privilege launch condition check
This can bite back during a repair; even though one shouldn't occur for this package,
so just remove the entry from the LaunchCondition table.
(hint: entry WHERE LaunchCondition.Condition='AdminUser')



Distribution Notes
============================================================================================
* Deployment Commands
- Install
msiexec.exe /i install_flash_player_10_active_x.msi TRANSFORMS=custom.mst /qb-!

- Uninstall
msiexec.exe /x {24762012-C6C8-4AAD-A02D-71A009FA1683} /qb-!


Known Issues
============================================================================================
* Auto-update notification update option
The auto-update notification will by default be disabled by the AutoUpdateDisable option
in the "mms.cfg" configuration file which applies for all users.
A user can enable/disable this option from the Global Notifications Settings tab in the
Flash Player Settings Manager and will be stored in the "settings.sol" file located under
"%APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys" as a user-
configuration. A user-configuration will not have any affect as the global configuration
defined by the mms.cfg file overrides the user-settings. Even though the "common global
security & privacy settings" takes preceeding the Flash Player Settings Manager will not
reflect these changes and may appear as not disabled.

We don't manage the "settings.sol" file as it has no real "value" for the end-user, purely
cosmetics.

* ICE Validation
Adobe is not known for its friendly MSI installers and this one is no exception.
The MSI is just a "wrapper" for the legacy installer (FP_AX_MSI_INSTALLER.exe) executed by
the custom action named "NewCustomAction1", the uninstall will be performed by
"uninstall_activeX.exe" as the custom action "CallExeUninstaller". There are a lot of
"lacy" ICE validation errors which we will not care about as long as the install/uninstall
is working.

ICE57 Error: Component 'ISRegistryComponent' has both per-user and per-machine data with
a per-machine KeyPath.
The actual content of the component is the "HKCU\Software\Macromedia\FlashPlayer\
FlashPlayerVersion" registry entry to reflect the current version however; as the component
do not hold a keypath the component's directory will be used as keypath instead. As this
folder is located outside of the user's profile we get the ICE57 error, a mix of user &
machine resources. The registry entry will not get added to the "next" user as no
entrypoint exist in this MSI and we don't really care about that entry either so we will
not fix this particular error.

ICE66 Warning: Complete functionality of the MsiFileHash table is only available with
Windows Installer version 1.5. Your schema is 110.
We do get an ICE warning for our added MsiFileHash table due to the old schema version
the vendor MSI is based on, we just go along with this.


References
============================================================================================
* URL: Adobe Player Licensing
http://www.adobe.com/products/players/fpsh_distribution1.html

* URL: Download Adobe Flash Player
http://www.adobe.com/products/flashplayer/fp_distribution3.html

* URL: Adobe Flash Player Administration Guide for Flash Player 10
http://www.adobe.com/devnet/flashplayer/articles/flash_player_admin_guide.html


* Database table definition
- Adding missing tables
The missing MsiFileHash & RemoveFile tables can easily be added by exporting the table(s) to
an "Archive File Format" (.idt) file from another MSI holding these tables (make sure no
entries exists before exporting as they would also be added during import) and import them
through the transform.

Below defines each table's .idt file which can be used during import instead.
(Note that each .idt-file content must end with an blank line.)
<START of MsiFileHash.idt>
File_ Options HashPart1 HashPart2 HashPart3 HashPart4
s72 i2 i4 i4 i4 i4
MsiFileHash File_

<END of MsiFileHash.idt>

<START of RemoveFile.idt>
FileKey Component_ FileName DirProperty InstallMode
s72 s72 L255 s72 i2
RemoveFile FileKey

<END of RemoveFile.idt>

- "_Validation" table entries for the MsiFileHash & RemoveFile table
(just copy'n past the below lines, including the ending new line)
MsiFileHash File_ N File 1 Identifier Primary key, foreign key into File table referencing file with this hash
MsiFileHash Options N 0 32767 Various options and attributes for this hash.
MsiFileHash HashPart1 N Size of file in bytes (long integer).
MsiFileHash HashPart2 N Size of file in bytes (long integer).
MsiFileHash HashPart3 N Size of file in bytes (long integer).
MsiFileHash HashPart4 N Size of file in bytes (long integer).
RemoveFile Component_ N Component 1 Identifier Foreign key referencing Component that controls the file to be removed.
RemoveFile FileName Y WildCardFilename Name of the file to be removed.
RemoveFile FileKey N Identifier Primary key used to identify a particular file entry
RemoveFile DirProperty N Identifier Name of a property whose value is assumed to resolve to the full pathname to the folder of the file to be removed.
RemoveFile InstallMode N 1;2;3 Installation option, one of iimEnum.

Answered 12/16/2009 by: AngelD
Red Belt

  • anyways Setting.sol is just cosmetic....we can always replace a file from user profile using MSI itself..we can Versionsed the newr file in File Table(just give veriosn 1.0 to setting.sol and delete entry from MSIFileHash table)...The higher version will always replce the lower version file..and in active setup use switch /FOxx..
Please log in to comment
Answer this question or Comment on this question for clarity