Customize MSI Log File Name in Start-ADTMsiProcess function via Extensions.psm1 File

Currently working with PSADT and trying to customize the log file name generated by the Start-ADTMsiProcess function via PSAppDeployToolkit.Extensions.psm1 File. I want the MSI log file to follow a custom naming convention as “$MyVariable_[MSI_MSIFileName]_DeploymentType.log”

log file is controlled internally via the $LogFileName variable inside Start-ADTMsiProcess and I have tried to update the same in PSAppDeployToolkit.Extensions.psm1 but it is providing below error message:
”Cannot write to function Start-ADTMsiProcess because it is read-only or constant.”
along with some other error as :
”Cannot retrieve the dynamic parameters for the cmdlet. The variable ‘$Script:CommandTable’ cannot be retrieved because it has not been set.”

Note: Tried value for $LogFileName = @{$false=[IO.Path]::GetFileNameWithoutExtension($MyVariable_)+“_[MSI_”+[IO.Path]::GetFileNameWithoutExtension($FilePath)+“]”;$true=‘’}[$logName -eq ‘’. Same was working with PSADTv3 version.

Can anyone guide what I am missing over here?

Just provide the file name as a parameter? Start-ADTMsiProcess · PSAppDeployToolkit

Thanks for the reply!

We can achieve this using -LogFileName Parameter (Simple way But needs to update for each MSI execution). Can we make it as a default MSI log file name via PSAppDeployToolkit.Extensions.psm1 file by mentioning the whole function over here and just updating that parameter.

Will that be possible in latest release?

You’d do that with $PSDefaultParameterValues: about_Parameters_Default_Values - PowerShell | Microsoft Learn