Post install execution of a batch file - Advanced Installer Community

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!

jmace
Posts: 55
Joined: Thu Jul 01, 2010 4:46 pm

Post install execution of a batch file

I have a batch file that needs to be able to be executed after the installation of a web application. This batch file encrypts the connection string and some application settings in my web.config. How do I go about doing this?

Thanks,
Jim
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Post install execution of a batch file

Hi Jim,

You can very easily run the batch using a "Launch File or Open URL" custom action. The custom action should be added under InstallFinalize standard action,
so it is executed at the end of the installation process.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jmace
Posts: 55
Joined: Thu Jul 01, 2010 4:46 pm

Re: Post install execution of a batch file

This topic can be cross referenced with this thread: http://www.advancedinstaller.com/forums ... =2&t=11427
jmace
Posts: 55
Joined: Thu Jul 01, 2010 4:46 pm

Re: Post install execution of a batch file

I have a batch file that encrypts my connection string. The installer has evolved, letting the user select a website. The batch file is pretty simple:

CD %WINDIR%\Microsoft.NET\Framework\v2.0.50727\

aspnet_regiis.exe -pe "connectionStrings" -app "/Tracker"

aspnet_regiis.exe -pa "NetFrameworkConfigurationKey" "NT Authority\Network Service"

aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"

I have a property VD_PATH, how can I replace "\Tracker" with this property?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Post install execution of a batch file

Hi,

Unfortunately this can be done only by using a separate custom action for each command (instead of a BAT). This way you can use the property in the custom action command line. You can still use "Launch file or open URL" custom actions, but they will launch "aspnet_regiis.exe" instead of a BAT.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jmace
Posts: 55
Joined: Thu Jul 01, 2010 4:46 pm

Re: Post install execution of a batch file

Okay. How do I get to: %WINDIR%\Microsoft.NET\Framework\v2.0.50727\ ? Are you suggesting that I include aspnet_regiis.exe in my installer, if so, how do I do that?

Jim
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Post install execution of a batch file

Hi Jim,

You can use WindowsFolder installer property instead of "%WINDIR%". So the custom action command line can look like this:

Code: Select all

"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe" -pe "connectionStrings" -app "[VD_PATH]"
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jmace
Posts: 55
Joined: Thu Jul 01, 2010 4:46 pm

Re: Post install execution of a batch file

I am encrypting using the physical path so I need to point to the APPDIR. However, I need this property without the trailing "\". How would I go about stripping that off?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Post install execution of a batch file

Hello,

Please refer to our user guide to solve this.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”