We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

BenKell
Posts: 11
Joined: Tue Aug 07, 2012 11:07 pm

Copy Different File Based on Registry String

Hey Guys -

I'm trying to build an installer using Advanced Installer 31.1 which will do something a bit unique. I have about 8 different "properties" files which are site-specific. During installation, only one needs to be copied from a currently unique filename into a pre-existing local folder with the target filename of "client.properties." I've already deployed a script which based on the system's OU has created a registry string in a common place on all workstations whose value is the PC's site name. How can I build an installer that will look at this registry key and if it matches 1 of ~8 values copy a specific file plsu rename it to client.properties (overwriting an existing one?)

Example / Explanation
Below are a few of the source files I have:
- "ILE Client Properties CBO.PROPERTIES"
- "ILE Client Properties QMC.PROPERTIES"
- "ILE Client Properties QRW.PROPERTIES"
etc…

1. During installation, the installer should look in the key HKLM\Software\Company for the string "Site" which will equal something like "Site1", "Site2", "Site3"...
2. If the string's value is "Site1", it should copy "ILE Client Properties CBO.PROPERTIES" into the local folder "C:\Application\Files" as (or renamed afterwards) client.properties - overwriting the existing file. If the string's value is "Site2", it should use the source file "ILE Client Properties QMC.PROPERTIES" and so on.

I found the below post which mentioned a registry search, but didn't follow and couldn't find out how to do it as well as copy the file with the renaming part.
http://www.advancedinstaller.com/forums ... php?t=1113

Any suggestions? Thanks!
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Copy Different File Based on Registry String

Hello,

You don't have to worry about renaming, here's what you need to do:
1. Create a search(e.g. SITE_NAME) from the Search page New Search - Add Location - Registry
2. Set its type to Retrieve the raw value
3. From the Files and Folders page add all files in the folder you want them installed
4. Select one of the files and press F8 to see all in their component in the Organization page
5. Right click on each and move them to their own component - Move to New Component
6. Select each component and set conditions based on the search name from step 1 (e.g. SITE_NAME = "Site1",etc)

If you already have a file installed in the same location on the target machine, all you need to do is:
- select all files from the Files and Folders page
- go to Operations tab and select Always overwrite existing file option

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”