Posts: 19
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


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 ''
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 ''
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 ''
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.

Posts: 3954
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


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 (73.59 KiB) Viewed 59 times
pathProperty.png (105.49 KiB) Viewed 59 times

Hope this helps!

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

Return to “Common Problems”