MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Execute PowerShell script before executing search

Hi,

In order to read and update the values of a given XML file, we want to use this feature that you offer, which is quite neat: https://www.advancedinstaller.com/user- ... -file.html

But our problem is that we have a malformed XML file (multiple root nodes). I wrote a PowerShell script that fixes the XML file, but I need to execute this script before any search-functionality of the installer is executed, otherwise all the searches will fail as a result. How to achieve this?

Best regards,
Johannes
Liviu
Posts: 1325
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Execute PowerShell script before executing search

Hello Johannes,

In order to achieve this, you can schedule your script before the Searches action group in the Custom Actions page:
ps script.png
ps script.png (93.16 KiB) Viewed 7525 times

Also, if the file is malformed when you import it, you can also try to fix it at build time by using the Build Events option. More details on the Use a Powershell script as a build event article.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Re: Execute PowerShell script before executing search

Hello Liviu,

Thanks for the quick reply, that works perfectly, now my searches are executing without any error!

Best regards,
Johannes
Liviu
Posts: 1325
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Execute PowerShell script before executing search

You're always welcome, Johannes!

It's great to hear that everything is now working as expected.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”