With the release of ConfigMgr Technical Preview 1912, the ability to quickly collect log files for specific devices is now available. While there were several ways of doing this in the past, we now can perform the action using native tools, without scripts or third-party add-ons. Now if we could only do this during deployment as well.
Sure enough, we can, and this method has been around for a long time. It has been part of the Microsoft Deployment Toolkit for years. Regardless of if you are using ConfigMgr for Operating System Deployment (OSD) or using native MDT for OSD, the ability to collect essential log files is available to you. The only requirement is an MDT Task Sequence. For ConfigMgr, this means you will need MDT integration, and for native MDT, you are all set. The other part you need is a file share, and to be honest, that should not be a problem. Setting this up requires a simple line in the "customsettings.ini" file and some configuration on the file share. So let's break down the slight differences between ConfigMgr and native MDT.
First up, native MDT. Start with creating a folder named Logs in your deployment share, and make sure to give your MDT user account, write permissions to the folder. There is no need to change the share permissions as the user should already have read permission to the share. Next, add the following line to your "customsettings.ini" file, and hey presto you are done. You will now receive logs for every machine performing OSD.
Now for those running ConfigMgr, you have slightly more work to do, but don't be scared; It's one extra step. Let's start by creating the share needed. Create a Logs folder in a suitable location, and this can be your primary site server or a distribution point. Next, make sure you share that folder as "Logs" and give your network access account read and write permissions to the share and folder. Next, add the same simple line we did before in native MDT but switch out "%DeployRoot%" with your server name, as seen below, and hey presto you will have logs for every machine deployed.
In both scenarios, this will create a separate folder with the computer name containing all the logs from the task sequence in the logs folder in a central location. The only downside is the lack of automatic cleaning. After a while, you will end up with many log folders taking up space. Make sure to clean them out or use PowerShell to automate the cleaning.