Collins
Posts: 138
Joined: Wed Oct 12, 2016 2:57 pm

Change Output Directory For Temporary PowerShell Files

Thu Apr 23, 2020 3:37 pm

Hi,

We have customers that block any powershell files that are placed under the C:\Windows\Temp directory. It would be helpful if there was an option to choose the directory that the temporary files are extracted to. For example, when using the InstallCertificate custom action, it places the PSS files under that directory and then their antivirus application (Cylance in this instance) blocks the custom action from successfully completing.

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

Re: Change Output Directory For Temporary PowerShell Files

Fri Apr 24, 2020 8:47 am

Hello Collins,

What you want to achieve can be done by taking the file and simply moving it to another directory. For instance, you can select your file, cut it (CTRL + X) and then copy it to another folder.

If you copy it to "Application Data" folder, the fille will be extracted in the %appdata% folder (WinDir\Users\<username>\AppData\Roaming)

Hope this helps.

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

Collins
Posts: 138
Joined: Wed Oct 12, 2016 2:57 pm

Re: Change Output Directory For Temporary PowerShell Files

Mon Apr 27, 2020 6:58 pm

Catalin wrote:
Fri Apr 24, 2020 8:47 am
Hello Collins,

What you want to achieve can be done by taking the file and simply moving it to another directory. For instance, you can select your file, cut it (CTRL + X) and then copy it to another folder.

If you copy it to "Application Data" folder, the fille will be extracted in the %appdata% folder (WinDir\Users\<username>\AppData\Roaming)

Hope this helps.

Best regards,
Catalin
Catalin,

That will not help because your built in custom action places it in that temp folder as soon as it begins and there is no way to move it once it begins. Also, your custom action is expecting it in that location:

Function AI_SetMsiProperty($name = $(throw 'AI_SetMsiProperty requires 2 arguments'), $value = $(throw 'AI_SetMsiProperty requires 2 arguments'))
{
"$name :<->: $value" >> $_msiPropOutFile;
}
&'C:\WINDOWS\TEMP\pssE07.ps1'-pfxCert "C:\WINDOWS\TEMP\vertafore.cer"
if ($LastExitCode -ne $null) {
exit $LastExitCode;
}
}

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

Re: Change Output Directory For Temporary PowerShell Files

Tue Apr 28, 2020 1:03 pm

Hello,

I may have misunderstood your scenario here.
That will not help because your built in custom action places it in that temp folder as soon as it begins and there is no way to move it once it begins. Also, your custom action is expecting it in that location:
I am not quite sure I understand about what custom action you are talking about here. Are you talking about the "InstallCertificate" predefined custom action?

I've ran a new test on my machine and everything seemed to be working as expected. Here are the steps I took:

- add the certificate (.cer file) as a temporary file

- cut it from the "Temp" folder (using CTRL+X) and move it to the "Application Data" folder

At this point, I have ran the installer to see if the file is extracted as expected and it was (in the %appdata% folder)

- I have now added the "InstallCertificate" custom action as a custom action with sequence. I have scheduled the custom action after the "Paths Resolution" action group in the "Wizard Dialogs Stage"

- I have the path to the certificate by inserting "[" in the "Path" field --> "File" --> select my certificate

- built and ran the setup

After checking the "certmgr.msc", I have noticed that my certificate was correctly installed.

From what I understood, this is your scenario. Please let me know if this is not what you are trying to achieve and, if so, please give me some more details so I can further investigate.

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

Collins
Posts: 138
Joined: Wed Oct 12, 2016 2:57 pm

Re: Change Output Directory For Temporary PowerShell Files

Mon May 04, 2020 6:53 pm

Thank you, I will give that a try.

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

Re: Change Output Directory For Temporary PowerShell Files

Tue May 05, 2020 1:36 pm

You are always welcome!

Please let me know if you encounter any issues.

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

jsmith99
Posts: 2
Joined: Thu Apr 29, 2021 11:29 pm

Re: Change Output Directory For Temporary PowerShell Files

Fri Apr 30, 2021 3:57 pm

We have this same issue, but its for some of the other custom actions launched by AdvancedInstaller. Is there a way to control where all dynamic powershell files are generated?

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

Re: Change Output Directory For Temporary PowerShell Files

Tue May 04, 2021 5:04 pm

Hello,

I have answered your other thread debating the same issue here:

Re: Ability Specify custom folder for dynamically created powershell files

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

Return to “Feature Requests”