[Incident]: Some users report they are unable to access the case portal. Please see this community notice for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LKM_N4EN
Level 6

Remove/Add File in Vista

Hi,

I called a custom action to remove file in "Program Files\My Product" folder. The custom action is calling installscript function "DeleteFile". In vista, this custom action is not working. The same thing happened if I want to edit a file or copy files to Program Files folder.

The custom action is working fine if we run from setup.exe and select "run as administrator". However, during uninstallation we use the command line "msiexec.exe /I {ProductCode}", and this does not run as administrator.
Labels (1)
0 Kudos
4 Replies
KathyMorey
Level 10

You'll need to run your custom action as "deferred in system context" so that it runs with elevated rights.
0 Kudos
LKM_N4EN
Level 6

Yes, I did run the custom action with "deferred in system contex". But I have problem in getting Windows Installer Property.

In the installscript function, I need to get the property of "INSTALLDIR" and "SUPPORTDIR". But using deferred in system contex, I have difficulties to access these property.

Referring to this:
[CODE]
For example, if you want to retrieve the values of [INSTALLDIR], [SUPPORTDIR], and [SetupType], you would set the Property Value setting of your type 51 custom action to this:

[INSTALLDIR];[SUPPORTDIR];[SetupType]

where each property is separated by a semicolon.

You can use code such as the following VBScript to “unpack” the values from the CustomActionData property:

Dim PropArray
PropArray = Split(Session.Property("CustomActionData"), ";")
INSTALLDIR = PropArray(0)
SUPPORTDIR = PropArray(1)
SetupType = PropArray(2)

[/CODE]

How can I get the INSTALLDIR value from VBscript and pass to my installscript function?
0 Kudos
KathyMorey
Level 10

You should probably look in the Windows Installer and InstallShield help for "CustomActionData". The elevated process in Windows Installer has very limited access to the MSI properties; using CustomActionData allows you to pass information to custom actions running elevated.
0 Kudos
sharon
Level 5

Hi,

If you do not want to disable the UAC service:
I suggest trying to run modify from the setup.exe instead of from add/remove programs (which runs the msi directly) in order for vista to allow elevation.

If you want to disable the UAC service:
Go to registry key:
Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System
and set EnableLUA=0 instead of 1.
then run the add/remove again - it should be able to modify the file system.

Sharon.
0 Kudos