BobCrothers
Posts: 66
Joined: Wed Dec 05, 2007 10:58 pm

Permission denied on VB script copy

Hi Gurus,

We have a vb script which is run under the InstallFinalize sequence. The vb script takes a property file which is in the directory where the install program is located and copies the property file to APPDIR with run-time-properties appended to the string/directory. This has worked fine for a couple years.

One of our clients wants to install our application on Windows 7, 64 bit. The VB script gets the following error on Windows 7,

Error coping to C:\Program Files (x86)\InformatixInc\RAPID\run-time-properties\ error (hex) 46 Permission denied

when it attempts to copy the property file.

The VB script is attached to the installation. The following properties are checked, synchronous execution, Immediate execution, and Always Execute.

After doing some research I thought "Deferred with no impersonation" would solve the permission problem. Question #1 will "Deferred with no impersonation" solve the permission denied problem?

"Deferred with no impersonation" was not available when the script was under InstallFinalize. I moved the scrip under Install, and "Deferred with no impersonation" is available. I can’t test it because now I can’t get the source directory.

Previously I used
currentDir = Session.Property("SOURCEDIR")
to get the source directory. This now returns an empty string.

If I call
appDir = Session.Property("CustomActionData")
I always get APPDIR. It does not matter what I put in the Action Data field. If Action data is blank I get appdir. If action data has a property (any property) I always get app directory. Question #2 how can I get the sourceDir in the VB script?

Thank You
Bob
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Permission denied on VB script copy

Hi Bob,

Yes, setting the custom action to deferred with no impersonation should work.
currentDir = Session.Property("SOURCEDIR")
to get the source directory. This now returns an empty string.
Deferred custom actions do not have direct access to properties. They need to use CustomActionData.
If I call
appDir = Session.Property("CustomActionData")
I always get APPDIR. It does not matter what I put in the Action Data field. If Action data is blank I get appdir. If action data has a property (any property) I always get app directory. Question #2 how can I get the sourceDir in the VB script?
I could not replicate this behavior with my test project. My settings:
Script Inline custom action under InstallExecuteSequence->Install with the following settings:

Code: Select all

Script Text: MsgBox(Session.Property("CustomActionData"))
Action Data: [SOURCEDIR]
Deferred with no impersonation.
Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
BobCrothers
Posts: 66
Joined: Wed Dec 05, 2007 10:58 pm

Re: Permission denied on VB script copy

Thanks Gabriel

Regarding this problem everything is working fine.

Now I can’t reproduce the problem of Session.Property("CustomActionData") always returning the APPDIR. The deferred with no impersonation gives my vb scripts the authority to copy and delete files.

Bob

Return to “Common Problems”