4.1.0 Log paths Setting

Praise to the developers
PSADT 4.1.0

there is no other way to adjust the log paths except in config.psd1
\Config\config.psd1
LogPath = 'C:\Logfiles\Software'

It would be nice if you could
Invoke-AppDeployToolkit.ps1
in the area

$adtSession = @{
LogPath = 'C:\Logfiles\Software'
LogPathNoAdminRights 'C:\Logfiles\Software'

in other words, can you write:
$adtSession.LogPath = "C:\logpath1" ?

Yes you can do that.

See this post

If it's set to default = empty in config.psd1, it only works if the directory exists.
There are two empty entries in config.psd1.

    MSI = @{
	LogPath = ''
	LogPathNoAdminRights = ''

and two with content

    Toolkit = @{
	LogPath = '$envWinDir\Logs\Software'
	LogPathNoAdminRights = '$envProgramData\Logs\Software'$

tried

    $adtSession.LogPath = "C:\Logfiles\Software1"
    $adtSession.LogPathNoAdminRights = "C:\Logfiles\Software1"

or in the HASH table

	##===============================================
    # App variables.
	##===============================================
    LogPath= "C:\Logfiles\Software1"
    LogPathNoAdminRights = "C:\Logfiles\Software1"
[Pre-Install] :: Executing ["C:\WINDOWS\system32\msiexec.exe" /x {a2c07f22-9423-4788-88da-7bc2edd65e18} ALLUSERS=1 REBOOT=ReallySuppress REBOOTPROMPT=Suppress ROOTDRIVE=C:\ /QN /L*V C:\Logfiles\Software1\Teamviewer-QuickSupport15_15.64.3.0_Uninstall.log]
[Pre-Install] :: Execution failed with exit code [1622]: Error opening installation log file. Ensure the specified log file exists and is not write-protected.

I'll leave it at the change in the Config.psd1, since I have both PSADT-Installation-Log and Source-Install.log there and the directory created if not present, thanks anyway

The code in Start-ADTMsiProcess should be creating the log directory if it doesn't exist:

# Build the log path to use.
$logPath = if ($logFile)
{
    # A defined MSI log path is considered an override.
    if (![System.String]::IsNullOrWhiteSpace($adtConfig.MSI.LogPath))
    {
        # Create the Log directory if it doesn't already exist.
        if (!(Test-Path -LiteralPath $adtConfig.MSI.LogPath -PathType Container))
        {
            $null = [System.IO.Directory]::CreateDirectory($adtConfig.MSI.LogPath)
        }

        # Build the log file path.
        (Join-Path -Path $adtConfig.MSI.LogPath -ChildPath $logFile).Trim()
    }
    elseif ($adtSession)
    {
        # Get the log directory from the session. This will factor in
        # whether we're compressing logs, or logging to a subfolder.
        (Join-Path -Path $adtSession.LogPath -ChildPath $logFile).Trim()
    }
    else
    {
        # Fall back to the toolkit's LogPath.
        if (!(Test-Path -LiteralPath $adtConfig.Toolkit.LogPath -PathType Container))
        {
            $null = [System.IO.Directory]::CreateDirectory($adtConfig.Toolkit.LogPath)
        }

        # Build the log file path.
        (Join-Path -Path $adtConfig.Toolkit.LogPath -ChildPath $logFile).Trim()
    }
}

I'll test and confirm whether this is the case or not.

Couldn't replicate. Is there any further detail you can share?

mjr4077au, please don't do it. I'll just change it in config.psd1, as I want to have the PSADT and installation logs together. You've solved this well, and I think it's an optimal solution. There's no point in investing any more time. I was on the wrong track. Thanks.