Hello Logan,
First of all, thank you for the explanation. Now I understand better your scenario and indeed, the way you wanted to proceed is the best way. By dynamically changing the log name, it would not be overwritten when running the installer again (but instead would create a new log everytime the setup is run).
However, after I have investigated this a bit more, I have come up with the main reason why that is not working and also with a workaround. First of all, the reason why that does not work is because the date and the time format contains characters that are not supported by Windows OS file name format (e.g. ":", "/").
The workaround to this is as follows: We will create a custom action based on a PowerShell script which will get your log file, copy it on the desktop and then rename it using timestamps.
In order to achieve those said above, please proceed as it follows:
-Go to
"Custom Actions" page
-Add a "Run PowerShell inline script" custom action without sequence by pressing the "Add custom action without sequence" button which is placed to the right side of the custom action name. We will add this without sequence, so we can trigger it from a dialog control (button) - that being the "Finish" button from our "ExitDlg" dialog.
-Under the "Your code goes here." comment, please insert the following script:
Code: Select all
tempFolder = $env:TEMP
$userProf = $env:USERPROFILE
$date = (get-date -format d) -replace("/")
$time = (Get-Date -Format t) -replace(":")
Copy-Item "$tempFolder\Installer.log" -Destination "$userProf\Desktop"
$newFileName = "$date"+"_"+"$time"+"Installer.log"
Rename-Item "$userProf\Desktop\Installer.log" -NewName $newFileName
-Now please go to
"Dialogs" page, select the
"ExitDlg" dialog and click on the
"Finish" button --> under
"Published Events" click on the "
New..." button to add an event with the following arguments:
-Event: Execute custom action
-Argument: PowerShellScriptInline
-Condition: leave unchanged
Hope this helps.
All the best,
Catalin