Eternal21
Posts: 21
Joined: Mon Aug 15, 2016 5:51 pm

'Run PowerShell Inline Script' can't access temporary files

Mon May 03, 2021 4:48 pm

I've got the following custom action called: RunInstallScriptInline

Image

It runs a powershell script that sets up self-signed certificates, website and app pools. In order to set up certificate I need to pass a crt and pfx files to it. I was trying to do it using temporary files, as following:

Code: Select all

-rootCaCrtPath "[&rootCA.crt]" -rootCaPfxPath "[&rootCA.pfx]" -rootCaPfxPassword '[pfxPass]' -siteName 'my.site.net'
But the project builder complains right away. In fact you can't even browse to temporary folder location. This seems to work fine if you 'Launch a file' instead of 'Run PowerShell Script Inline'.

I even tried the following, which got around builder errors, but didn't work during runtime (the installer couldn't find the temp files at the location specified)

Code: Select all

-rootCaCrtPath "[TempFolder]rootCA.crt" -rootCaPfxPath "[TempFolder]rootCA.pfx" -rootCaPfxPassword '[pfxPass]' -siteName 'my.site.net'
What am I doing wrong? For the time being my workaround is just including the crt, pfx files in the project output folder:

Code: Select all

-rootCaCrtPath "[#rootCA.crt]" -rootCaPfxPath "[#rootCA.pfx]" -rootCaPfxPassword '[pfxPass]' -siteName 'my.site.net'
The problem with this approach is that I don't want those files on the system after the install is done (hence why I wanted to use temporary files in the first place). How can I remove the files, if temporary files are not supported by inline scripts.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: 'Run PowerShell Inline Script' can't access temporary files

Thu May 06, 2021 6:50 pm

Hello,

I have ran a few tests on my end and it looks like you indeed can not pass the path to a temporary file, at least not in the "regular" way (i.e. entering "[" in the field --> "File" --> select your temp file).

However, every temporary file has a property assigned to it that stores its' path and that should do the trick for you.
tempProperty.png
tempProperty.png (73.59KiB)Viewed 3589 times
pathProperty.png
pathProperty.png (105.49KiB)Viewed 3589 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Eternal21
Posts: 21
Joined: Mon Aug 15, 2016 5:51 pm

Re: 'Run PowerShell Inline Script' can't access temporary files

Wed May 19, 2021 9:24 pm

The workaround works. Thanks.

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: 'Run PowerShell Inline Script' can't access temporary files

Thu May 20, 2021 6:48 pm

Hello,

Thank you for your followup on this!

I am glad to hear it worked.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”