In PSADT v4.1, how can i change all log's location, in real time?
in 3.10.2, i add somethink like this
$customLogPath = $LogAuto = Join-Path -Path "$env:SystemRoot\Temp\Logs" -ChildPath "LogFolder"
If ($Variable) {
$configToolkitLogDir = $customLogPath
$configMSILogDir = $customLogPath
}
With this, i can redirection the logs to another folder than the default, but i'm struggling with v4.1
It's too bad the path isn't inside an environment variable. Then you could have used it directly in the Config.psd1
The best time to set the log file location is BEFORE the session opens.
I know you can change the NAME of the log file but I've never tried to set the log file LOCATION.
Near the top of the FrontScript (aka Invoke-AppDeployToolkit.ps1) where $adtSession is defined, try something this:
Got another issue, when i run the Invoke-AppDeployToolkit.exe, passing a custom parameter
([Parameter(Mandatory = $false)]
[switch]$Log= $false),
and using the code that @mjr4077au sent, i get this on the debug window
(Open-ADTSession : Cannot convert the object of type 'System.Management.Automation.PSObject' to type 'System.String'.
At C:\Test\Invoke-AppDeployToolkit.ps1:324 char:19
+ $adtSession = Open-ADTSession @adtSession @iadtParams -PassThru
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (60008:Int32) [Open-ADTSession], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Open-ADTSession
Can you open a PowerShell window, import the module (the PSAppDeployToolkit folder), run & 'C:\Path\To\Invoke-AppDeployToolkit.ps1', then run Resolve-ADTErrorRecord -ErrorRecord $Error[0]. There's not enough info without a resolved error output.
EDIT: i fixed it, the problem was the variable that was getting the log path.
Can close it, and thank you for your availability, you guys @mjr4077au and @That-Annoying-Guy