Friday 23 May 2014

Collecting SMSTS.log files to a remote share from a failed SCCM Task Sequence

I am going to presume that you can create a shared drive on Windows OS
You are using some kind of Virtual Machine (VM) ie Hyper-V or VMWare
Create a shared folder with accessible account, you need to connect to the root of this share.
You have some basic understanding of how to create steps within a TS
TS = Task Sequence

This process allows you to view failed OSD log files, without have to be sat waiting at a failed system.
With a new or any already created building/deploying task sequence with SCCM;

THIS IS THE IMPORTANT BIT.... if you do not do this it will not work
Create a New Group at the ROOT of the Task Sequence.

Create a New Group at the ROOT of the Task Sequence. The very first thing it does within the Task Sequence, NOTHING should be above this. This encapsulates the whole of the TS
Name it whatever you wish, but in mine I have called it;

Capture SMSTS log files
Move all the existing task sequence steps into this New Group (Capture SMSTS log files)

Next Create a New Group at the end of the exisiting Task Sequence
I called mine Send Logs as that what I wanted to do send teh logs files from a failed TS to a share I can use SCCM Trace tool

In the Options Tab within the New Group you have just created,
You need to add a TS variable,
Add Condition, Task Sequence Variable
Set the Variable to _SMSTSLastActionSucceeded
Set the Value to False

Under the Group you have just created (Send Logs)

Create a TS step;
Add, General, Connect to a network folder
Complete the mapping, path; drive and Account
 remember you must have write access to the path
I used M: as my drive letter, this will become apparent in the next steps.
Next step
Add, General, Run Command Line
enter at the Command line field, cmd /c rd /s /q m:\%_SMSTSMachineName%

Next Step
Add, General, Run Command Line
Enter at the Command line field, cmd /c md m:\%_SMSTSMachineName%

Next Step
Add, General, Run Command Line
Enter at the Command line field, cmd /c copy %_SMSTSLogPath%\*.* m:\%_SMSTSMachineName%

When the TS fails now you will have log files in the shared folder you mapped earlier....
Now you can use SCCM trace tool to actually view the failure, in a properly formatted style rather than viewing in a notepad text file.... yes I can do the text file but there is always an easier way....

Hope you found this useful....
I did not do screen grabs as you should be able to complete this fairly simply

Just as a quick test to see that you will get the logs, set the TS step Partition disk 0 to a larger disk size the than the Virtual Disk you create for your VM, say set Partition Disk 0 to 20GB when the actual VM disk is only 10GB.... this will cause the TS to fail definitely... :)

Error from within failed SMSTS.log

Partition 0 larger than remaining disk space. Requested partition size: 20401094656, remaining size: 10733990400

see.....