How to add powershell script as custom action in visual studio setup project

567 Views Asked by At

I have written one powershell(IPConfiguration.ps1) script to change the static IP address , subnet address and for disabling the IPV6 option in the ethernet network Interface. PowerShell script working well without any issue. When launching in my machine on PowerShell command prompt. Now I am creating setup file using visual studio 2022 setup project. and wanted to launch this IPConfiguration.ps1 PowerShell script after installation, so all IP address and others option get set automatically. I believe this can be done by providing the custom action but I am not aware how to use powershell script as custom action in visual studio setup project. Because Visual studio only allow to create custom action for exe,dll,js etc not for powershell script files. so can any one please guide me , how can I use IPConfiguration.ps1 script as custom action in Visual studio 2022 setup project? Many thanks in advance for any lead or solution.

I tried below solutions. Execute an script/application after installing (using VS Setup Project) https://stackoverflow.com/questions/2414956/how-to-run-a-bat-file-during-installation#:~:text=Here%27s%20what%20you%20do%3A%201%20Create%20a%20setup,want%20to%20execute%20and%20cmd.exe%20%28C%3A%5CWindows%5CSystem32%5Ccmd.exe%29%20More%20items

Tried above solution by replacing powershell.ps1 script in-place of batch script and replacing cmd.exe with powershell.exe along with proper parameter.

0

There are 0 best solutions below