sasha
Posts: 67
Joined: Fri Oct 20, 2023 8:37 pm

How to prevent script sources from appearing in the log

Hello!
This is related to an issue discussed a while ago here - how to hide properties from being written in a log.

I see that the source code for our inline PS scripts is written in the log file. What's worse, the parameters are logged also. Here is an example

Executing op: CustomActionSchedule(Action=CustomScript,ActionType=3073,Source=BinaryData,Target=RunPowerShellScript,CustomActionData=DigitallySignScript1Flags0LaunchDirParams"C:\test\" "argument1" "" "" "account" "password"Script#Requires -version 3
.....

I tried adding the name of the custom action to the value of the `MsiHiddenProperties`. Added a property with the same name and marked it hidden. Neither doesn't help. Early on in the log file I see the property as masked, but eventually its full source code and arguments are logged.

Is there any way to prevent the source/arguments from being logged?

Thanks!
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent script sources from appearing in the log

Hello,

Can you please take a look over the following article:

How to hide your PowerShell custom action code from the log

which covers the same scenario and let me know if it helps?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sasha
Posts: 67
Joined: Fri Oct 20, 2023 8:37 pm

Re: How to prevent script sources from appearing in the log

Thanks for the reply, Catalin! I will give it a try. One thing I didn't do in my trials was adding the 8192 to the value.

I forgot to mention this in the original post, but the same issue exists with the command line for the .exe installer - it is logged, including possible sensitive parameters.
Adding EXE_CMD_LINE property. Its value is '/exenoupdates /forcecleanup /wintime 1738878268 /Lv*xp info.txt '.

I hope the same trick will take care of this property.
Will post an update.
sasha
Posts: 67
Joined: Fri Oct 20, 2023 8:37 pm

Re: How to prevent script sources from appearing in the log

The trick worked.
Now the properties, including the custom action scripts are not present in the log file.

Wanted to say that before posting the question I did search with Google, but the suggested article didn't come up in the results. I searched for 'how to hide powershell script in the log advanced installer'. Or something like that :)
sasha
Posts: 67
Joined: Fri Oct 20, 2023 8:37 pm

Re: How to prevent script sources from appearing in the log

I tried the same with the VBScript CAs but it didn't seem to work. Any other trick for inline VBScript?

Thanks!
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent script sources from appearing in the log

Hello,

Glad to hear it worked for PowerShell! :)

Regarding VBScript, I would suggest moving that over to PowerShell if possible, as VBScript will become deprecated.

Please read the following article for more information about this:

VBScript Deprecation impact and solution on installer packages

If you currently can not or do not want to switch over to PowerShell, please let me know and I will look into hiding the VBScript content as well to see whether it is possible or not.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sasha
Posts: 67
Joined: Fri Oct 20, 2023 8:37 pm

Re: How to prevent script sources from appearing in the log

Thanks. At this point we can leave the things as they are.
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: How to prevent script sources from appearing in the log

You are always welcome! :)

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

Return to “Common Problems”