Changing all the log files dynamically

The company I work in, recently decided to change from AutoIt, and look into PSADT as a package deployment alternative.
I’m working on creating a basic Deploy-application.ps1 file that will work on 90% of our needs with no interaction with the script itself. Simply modify an “.ini” file with the needed information (software name, version etc…) and the powershell takes care of the rest.

I’m having “issues” with logging. Using the native Write-Log function, i’m able to add “custom” logs when something goes wrong. But I don’t have the full logs.

I’m aware that there needs to be a change to the XML file with a custom path for it to work.
But would there be a way to have it change dynamically depending on the name of the package ? (e.g. package name is “GoogleChrome” logs will be in C:/DeployLogs/GoogleChrome/Googlechrome.log).

What would be the best way to get to that point ?
Can the function in the AppDeployToolkitMain be modified ? or do I have to add the -logpath and -logname to every write-log in that AppDeployToolkitMain to go to the path I want it to ?

Thanks in advance for the help, happy friday

Digging more. I’m able to change the Logfile in my Deploy-Application.ps1. And found out that i can do the same with my $configtoolkitlogDir. But that get overritent once I dot source the APDT functions.
Would there be a better way then changing the 2 lines that do
[String]$configToolkitLogDir = $ExecutionContext.InvokeCommand.ExpandString($xmlToolkitOptions.Toolkit_LogPath)
with my custom location in the AppDeployToolkitMain ?

The easiest way do this would be to programatically change the xml <Toolkit_LogPath></Toolkit_LogPath> in the AppDeployToolkitConfig.xml (found below the AppDeployToolkit folder)

We use Intune so ours is configured to “$envProgramData\Microsoft\IntuneManagementExtension\Logs” so we can download our installation logs from any device


So all the log files from PSADT are in the same folder ?
If that’s the case it won’t really work for me. We want them to be in subfolder, named after the appname. And changing the xml file to reflect the appname isn’t the suitable option in my case.

I make my log files match the name of the Deploy-application.ps1 file. (I rename Deploy-application.ps1 file to match the app e.g. GoogleChrome_v99r1)

They ALL go to the same folder.

PSADT has a poorly documented switch in the XML to do this.
That said, I also combine all the log files produced by the script and whatever it launches into ONE log file. Therefore in my GoogleChrome_v99r1.log file I get the MSI/EXE log file + the PSADT log file.

No subfolders, no mess of logfiles, no ZIP file of log files that need to be extracted to be read.

This way, I need ONE log file to troubleshoot from the user.


Alright. I think my makeshift solution will do for now. Thanks to both of you for taking the time.
Have a nice week end !



1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.