Copy files to Program Files 64 doesn't work - File and Folders - Advanced Installer Community
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Copy files to Program Files 64 doesn't work - File and Folders

Hi,

I have a project with 32-bit package type. In Files and Folders, I added files in Program Files and Program Files 64. The folders and files are correctly copied in Program Files (x86) but not in Program Files when I install the program. I tested on a 64 bit OS. The files are simply PowerShell scripts that need to be copy to WindowsPowerShell/Modules to be detected in both PowerShell and PowerShell (x86).

I tried to change my Package type to Mixed 32/64-bit matching the platform but I still have the same issue.

Am I missing something?

Best regards,
Horatiu
Posts: 42
Joined: Tue Nov 29, 2016 1:19 pm

Re: Copy files to Program Files 64 doesn't work - File and Folders

Hello,

You cannot make a 32-bit package and place files in the Program Files 64, they won't be installed there.
To learn more about packages follow this link: Package Types

Regarding, having a Mixed 32/64 bit package, you need to specify which component is 64-bit. To do this, go to the Organization tab in
the side panel, select the Component you want to be 64-bit. In the Attributes section check the option 64-bit Component.
To learn more about components follow this link: Component Properties

Best regards,
~Horatiu
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Re: Copy files to Program Files 64 doesn't work - File and Folders

Hi,

Let's I say I want to keep the package type 32-bit. Is it possible with a inline PowerShell script to copy the folders from the Program Files (x86) to Program Files or $env:ProgramFiles redirects to Program Files (x86)?

Best regards,
Horatiu
Posts: 42
Joined: Tue Nov 29, 2016 1:19 pm

Re: Copy files to Program Files 64 doesn't work - File and Folders

Hello,

It is recommended that only 64-bit programs be stored in "Program Files" but, yes it is possible to copy from from "Program Files (x86)"
to "Program Files", using a PowerShell inline script.

Place your PowerShellScript custom action after the Add Resources step, and make sure that After the system has been successfully modified and
Run under the LocalSystem account with full privilages are checked in Execution Time and Execution Options sections of your custom action.

To check the PowerShell commands, you can follow this link.

Best regards,
~Horatiu
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Re: Copy files to Program Files 64 doesn't work - File and Folders

Hi,

The inline PowerShell script doesn't seem to be executed. When I execute the code outside of Advanced Installer the script works.

I made a sample aip project that is available in the attachments where my issue happens.

Best regards,
Attachments
CopyItemPSInlineScript.aip
(18.48 KiB) Downloaded 453 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Copy files to Program Files 64 doesn't work - File and Folders

Hello,

This happens because you are not executing the script as a 64-bit script. When the script is executed as a 32-bit script the PowerShell redirects the paths to 32-bit location.

Just make sure you check the "64-bit script" option and rebuild again the project.
snapshot.jpg
snapshot.jpg (309.99 KiB) Viewed 6530 times
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”