I love a good logfile and operating system deployment (OSD) has a whole bunch of useful logs. The log files created during OSD are vital for troubleshooting. I come across many customers who get several OSD failures in remote sites, they really battle to troubleshoot the issues and it can be challenging to get hold of the logs.
The Microsoft Deployment Toolkit (MDT) has a great script that can save loads of time, zticopylogs.wsf. Using the task sequence variable SLShare and this script you can get the OSD logs copied to a network share when a build failures or when a build completes.
The process below copies the log files from C:\Windows\CCM\Logs\SMSTSLog to the location set by SLShare and the domain join logs from C:\Windows\Pather folder.
I find it really useful to also have a few other log files copied to the SLShare location. By copying the following log files to C:\Windows\CCM\Logs\SMSTSLog before the Copy Logs task sequence step the logs will be copied to the SLShare for review and troubleshooting.
- log – ConfigMgr Package installation
- AppDiscovery – ConfigMgr Application installation requirement assessment
- AppEnforce – ConfigMgr Application installations
Step 1. Create a network share
I tend to use a single central network share on the Primary or CAS. The share will need to writeable by the everyone built-in group.
Step 2. Continue on Error
Set the first group of the task sequence to continue on error, this will ensure that if the task sequence fails the logs will get copied.

Step 3. Set SLShare
Set the SLShare variable that is used by the zticopylogs script.

Step 4. Use MDT Toolkit
The deployroot variable is create by this step and the scripts are copied to C:\_SMSTaskSeqeunce\WDSPackage

Step 5. Check for a failure
The group will only run if there was a task sequence failure.

Step 6. Copy Useful Logs
This command line will copy the useful logs to C:\Windows\CCM\Logs\SMSTSLog
Cmd /c copy C:\Windows\CCM\Logs\AppEnforce.log C:\Windows\CCM\Logs\SMSTSLog\ & copy C:\Windows\CCM\Logs\AppDiscovery.log C:\Windows\CCM\Logs\SMSTSLog\ & copy C:\Windows\CCM\Logs\ExecMgr.log.log C:\Windows\CCM\Logs\SMSTSLog\


Step 7. Copy the logs
Runs the command: cscript “%deployroot%\scripts\zticopylogs.wsf”

Step 8. Go view the logs
A folder is created using the OSDComputerName variable and the logs are copied in.
