Quickpost – Logging with PSADT

Adding to the streamlining application management with PSADT and Microsoft Intune articles, you can read part 1 here, I briefly want to cover how to add custom logging to the deployment process and how to enable logging of EXE file install/uninstall process .

Logging is important, especially when troubleshooting the application install/uninstall process and while PSADT by default, has MSI file install/uninstall logging and logging of the PSADT script execution process, there may be scenarios where you want to have either additional logging or enable logging of an EXE file install/uninstall process.

PSADT custom logging

One of the many beauties of using the PSADT framework are the built-in features, this includes among other things, a logging feature. The logging feature called “Write-Log” supports a lot of different parameters. I will not go over every single parameter, but I’ll cover a few of the parameters and how to implement the logging feature.

If you want to familiarize yourself with the Write-Log feature, I recommend that you take a look at PSADT documentation here.

Implementing Write-Log

Let’s look at how to implement the Write-Log feature in the PSADT script.

In this case I am installing the .NET Framework 3.5 feature using the Enable-WindowsOptionalFeature command. I am doing a check on whether .NET Framework 3.5 is already installed and if not, install it and log the process.
Additionally, I have configured the Enable-WindowsOptionalFeature to log the .Net Framework 3.5 install process to a separate log file, this enables me to troubleshoot the .NET Framework 3.5 install process if needed. This log file is created in the PSADT log directory using the $configToolkitLogDir variable configured in the AppDeployToolKit.xml, I have covered the XML file in this blog post.

Log diving – .NET Framework 3.5

Let’s look at how this looks like in the PSADT log.

Here you can see the “Enable .NET Framework 3.5” message indicating that the .NET Framework 3.5 feature is going to be installed.

Executing the .NET Framework 3.5 install process again, updates the PSADT log fil with this information:

As expected, PSADT logs that .NET Framework 3.5 is already installed.

As mentioned before, in the PSADT log folder we also find the separate log fil for .NET Framework 3.5 install process using the Enable-WindowsOptionalFeature command:

As I have configured “Debug” in the -LogLevel parameter there are a lot of information available in the log file:

Here we can the command used to install .NET Framework 3.5 and where to find the log file.

Enable EXE file logging

Configuring logging with an EXE file-based installer can sometimes be a bit tricky. Most EXE file-based installers support providing a command line parameter to enable logging of the install process. However, some older applications might not support providing a parameter to enable logging, this is unfortunately, not something PSADT can remediate.

In this case we are going to look a bit closer at how to configure logging of the install process of the Microsoft Desktop Runtime 8 application.

As you might notice, there are some similarities from before, with the .NET Framework 3.5 install.

Log diving – Microsoft Desktop Runtime 8

The Microsoft Desktop Runtime 8 EXE installer supports logging via the /log parameter, and just like before the log file goes to the PSADT log folder:

Here we can see the complete command line for installing Microsoft Desktop Runtime 8 including the path to the log file.

Once again, we have a separate log file for Microsoft Desktop Runtime 8, in this case there are 5 separate logfiles.

Let’s have a look at the “Microsoft_Desktop_Runtime 8_Install” logfile:

Here we can see the command line used to install Microsoft Desktop Runtime 8, with a few additional install parameters added by the installer. We can also see that Microsoft Desktop Runtime 8 is split up on 4 different MSI based installers, and in the previous screenshot, we can see they have their own individual log file.

This concludes the article. Feel free to reach out to me on X or on LinkedIn if you have any comments or questions.