Issue Description:
A key requirement with a task sequence is to intelligently capture logs in case of a failure or a success. Some of the key issues faced while working with task sequences are:
- Log files in a task sequence hop from one folder to another depending on the OS installation and the SCCM Client Installation status.
Path of the log file | OS Status | SCCM Client Status |
<largest fixed partition>\SMSTSLOG | Windows PE | Not Applicable |
%temp%\SMSTSLOGS | full operating system | No |
C:\windows\ccm\Logs | full operating system | Yes |
This issue of hopping log files accentuates when the Task Sequence fails and it is difficult to locate the exact location of the log files.
It also becomes challenging to look for smsts logs when mass deployments are done. It is important to know how to manage logs for successes and failures, therefore the requirement is to copy the smsts.log to a central share and easily differentiate whether the deployment was a success or a failure
- In addition, when a particular task of the sequence fails, there is an error prompt that stays for 15 minutes or so and the machine reboots thereafter. In case the administrator is not in front of the machine where the TS failed, he or she would not know upfront that there was a failure until he or she checks the log files. Therefore one requirement is to halt the task sequence where it fails
Solution Description:
Based on the above issues and requirements, the key tasks we need to accomplish are:
If the task sequence (TS) is a success, then
- The logs should get copied to a central share
- Into a folder called SUCCESS
- And the TS should complete gracefully
If the TS is a failure, then
- the logs should get copied to a central share
- into a folder called FAILURE
- Also the TS should halt immediately so that the admin can see that there was a failure
We will accomplish this requirement by using in-built variable in the task sequence - _SMSTSLastActionSucceeded. This variable captures the state of the last action and returns TRUE when the action was successful and FALSE when there was an error.
# | Description | Screenshot |
1 |
| |
2 |
- Set "Main TS" group to Continue on error
| |
3 |
- Add a condition to the "Success" group:
Evaluate whether the TASK SEQUENCE VARIABLE: _SMSTSLastActionSucceeded equals TRUE
- Here the variable _SMSTSLastActionSucceeded captures the status of the last task executed
- If there is a failure in the MainTS, the _SMSTSLastActionSucceeded will be set to false, else true
- The TS will enter Success group only if there are no errors in the previous tasks
|
|
4 |
- Similarly, add another condition to the "Failure" group:
Evaluate whether the TASK SEQUENCE VARIABLE: _SMSTSLastActionSucceeded equals FALSE
- The TS will enter Failure group only if there are errors in the previous tasks
|
|
5 | Add the following logic under the Failure Group:
This is the share where all the logs will get copied | |
6 |
- Delete any folder associated with a computer name in the Failure Folder -> \\<servername>\LogFileShare\Failure\<computername>
- Add a Run Command Line tasks and put the following command in the command line:
- cmd.exe /c rd L:\Failure\%_smstsmachinename%% /s /Q
- Here %_smstsmachinename%% command refers to the computer name of the target computer
This task is necessary to ensure all earlier logs corresponding to the machine are deleted |
|
7 |
| |
8 |
- Copy the log files from the smstslog file path to \\<servername>\LogFileShare\Failure\<computername>
- Add a Run Command Line tasks and put the following command in the command line:
- cmd.exe /c copy %_smstslogpath%\*.* L:\failure\%_smstsmachinename%
| |
9 |
- Halt the Task Sequence by invoking a simple wscript.echo command
- Invoke a simple vbscript that prompts the path of the folder where the logs are kept:
- Script.echo "There is an error in the task sequence implementation. The log files are stored at \\<servername>\LogFileShare\"
| |
10 |
- Add similar tasks for group "Success"
| |
11 |
- Create a folder on the server for storing the logs and share it with Everyone Full Control
- Create 2 additional folders called Failure and Success
| |
12 |
- The Failure and Success folders will get populated with appropriate computer names
|
|
Hello Sandeep,
ReplyDeleteThis is a terrific article, well explained and easy to follow.
Whilst I haven't implemented your steps in my environment, I do plan to do something like this so that I am aware of Task Sequence failures.
I have been investigating whether it is possible to trigger an email to be sent when a Task Sequence completes, but your suggestion of writing to files is just as useful.
Regards,
Daniel
Melbourne, Australia
I am glad that you found this article useful. Daniel, regarding your requirement to send an email after the TS, you can create a vbscript and call it at the end of the Task Sequence:
DeleteSet objEmail = CreateObject("CDO.Message")
objEmail.From = "me@mydomain.com"
objEmail.To = "you@yourdomain.com"
objEmail.Subject = "Server is down!"
objEmail.Textbody = "Server100 is no longer accessible over the network."
objEmail.Send
reference: http://www.petri.co.il/send_mail_from_script.htm
It Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download Now
Delete>>>>> Download Full
It Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download LINK
>>>>> Download Now
It Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download Full
>>>>> Download LINK zx
Hello,
ReplyDeleteI have this working in my environment, and it is awesome. I used %OSDComputerName% instead though, to get the more friendly name of the machine, instead of MININT-XXXXXX
Thank you. it is very heartening to see that you found the article useful :)
DeleteI know this is a pretty old comment but I was just wondering how you got %OSDComputerName% to work. I'm not having any luck, my folder keeps getting created as literally "%OSDComputerName%" instead of the true computer name. I do use this variable earlier in my TS to set the computer name so I just assumed I could use it again in this instance.
DeleteI think that's because you need MDT integrated in SCCM to use this variable. But I'm not 100% sure.
DeleteHi Sandeep,
ReplyDeleteLooks like your famliar with SCCM.Basically Iam begineer to SCCM. Can you help me in getting some notes/stuffs for SCCM which includes of Planning, Deploying and Managing Microsoft System Center Configuration Manager 2007
Regards,
Santosh
Hi Sandeep, great article! Thanks for the info.
ReplyDeleteWould it be possible for you to share the AddErrorPrompt.vbs file that you used to halt the TS and display the error message?
Thanks again!
Phil
Excellent article!! Your explanations are awesome.
ReplyDeleteThanks
Tom
The AddErrorPrompt.vbs is just at txt string like this:
ReplyDeleteWScript.Echo "There is an error in the task sequence implementation." & VbCrLf & VbCrLf & "The log files are located at \\Your server\TSLogFile\"
Hey Sandeep,
ReplyDeleteI actually DID credit my source for that info in my blog post (which I wrote based on the steps I did to implement a similar solution; I didn't "copy paste" as you said). If you look, you can see that I credited Steve Rachui and link to his post from July of 2008 (http://blogs.msdn.com/b/steverac/archive/2008/07/15/capturing-logs-during-failed-task-sequence-execution.aspx) in the opening paragraph. His post is from a year and a half before your article, and is the one I found when I was was trying to set this up.
Thanks anyway!
-Mark
(I tried to send this via email but the email address you used to leave the comment on my page doesn't work.)
This is exactly what I was looking for thank you so much.
ReplyDeleteThis is a great article.
ReplyDeleteMy apologies for I'm a beginner in SCCM 2012. I also have a task sequence for a Terminal Server which involves many steps (installing update/software/reboots).
Would I need to create this logic after/during each step or just once at the bottom as final step of the TS..?
Bonjour,
ReplyDeleteMerci pour cet article.
Bonne continuation.
Hi Thank you for a very intuitive article. After following the steps above, my still doesn't work. I also do not understand the part where you ticked the package tickbox. Where was that package created? My vb script also does not prompt me at all. I have followed the steps diligently but, the only part I missed out is the packed bit. What am I doing wrong?
ReplyDeletehej there,
ReplyDeletethank you for this great howto. i have problems deleting existing folders with cmd.exe /c rd L:\Failure\%_smstsmachinename%% /s /Q. the logfile says: no such folder or file. is the variable working?
kind regards
tommy
I keep getting a disconnected network drive on my clients when following this guide..
ReplyDeleteAny ideas?
@Martin Thomson, you need to run a command line after the logs have been copied that basically does the following:
ReplyDeletecmd.exe /c net use L: /delete
Check out my post here http://d4rkcell.com/archives/1547 which uses this structure but builds upon the command line usage. It uses a VBS script to copy the logs and so far it works well.
ReplyDeleteSCCM JOBS ADDA
ReplyDeletehttp://dhuvurunaresh.blogspot.com/
http://dhuvurunaresh.blogspot.com/
ReplyDeleteI did as you instructed here but it wasn't working so I tested and found it would be easier to have it write to the destination using a UNC path. I tested all the commands by running them in an admin command prompt and it created and deleted folders yet when the TS is over no new files are created in Success or Failure. I have MDT so I'm not sure what's going wrong?
ReplyDeleteHi Sandeep,
ReplyDeleteTS fails at the stage when system is not getting IP. At that time mapping a network drive is not possible to copy the logs.
do you have any solution for that ??
Thank you so much for this wonderful article really! Please Visit:
ReplyDeletesccm implementation
16 bit applications
application packaging
Best SCCM Training Institute in Hyderabad
ReplyDeleteIt Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download Now
ReplyDelete>>>>> Download Full
It Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download LINK
>>>>> Download Now
It Evangelist: Sccm 2012 – How To Catch Errors In Task Sequence >>>>> Download Full
>>>>> Download LINK
https://istanbulolala.biz/
ReplyDeleteJ4OUW
yalova evden eve nakliyat
ReplyDeletetunceli evden eve nakliyat
giresun evden eve nakliyat
ağrı evden eve nakliyat
van evden eve nakliyat
YZ7MH
FF403
ReplyDeleteMardin Şehirler Arası Nakliyat
Samsun Lojistik
Çankırı Parça Eşya Taşıma
Çorum Lojistik
Kastamonu Şehirler Arası Nakliyat
Edirne Evden Eve Nakliyat
Bingöl Parça Eşya Taşıma
Siirt Evden Eve Nakliyat
Kütahya Evden Eve Nakliyat
9FF75
ReplyDeleteBayburt Şehirler Arası Nakliyat
Çerkezköy Motor Ustası
Mamak Boya Ustası
Mersin Şehir İçi Nakliyat
Erzincan Şehir İçi Nakliyat
Antalya Şehir İçi Nakliyat
Düzce Parça Eşya Taşıma
Ordu Evden Eve Nakliyat
Çankaya Boya Ustası
0A4CE
ReplyDeleteresimli magnet
binance referans kodu
referans kimliği nedir
resimli magnet
referans kimliği nedir
binance referans kodu
resimli magnet
binance referans kodu
binance referans kodu
F4C85
ReplyDeletereferans kimliği nedir
binance referans kodu
binance referans kodu
resimli magnet
binance referans kodu
referans kimliği nedir
resimli magnet
binance referans kodu
resimli magnet
F50EE
ReplyDeleteresimli magnet
referans kimliği nedir
binance referans kodu
binance referans kodu
binance referans kodu
resimli magnet
referans kimliği nedir
resimli magnet
binance referans kodu
40C14
ReplyDeletekripto kanalları telegram
canlı sohbet
mexc
binance referans kod
bitcoin grupları telegram
okex
mexc
kraken
binance
3F449
ReplyDeleteparibu
probit
referans kodu binance
huobi
bitmex
ilk kripto borsası
toptan sabun
mercatox
coin nereden alınır
BBA0F
ReplyDeletereferans kimliği nedir
mobil 4g proxy
bybit
kraken
October 2024 Calendar
canlı sohbet uygulamaları
May 2024 Calendar
kaldıraç ne demek
bitget
8C306
ReplyDeletebinance
coinex
October 2024 Calendar
cointiger
kraken
referans kimliği
March 2024 Calendar
mexc
kripto para nasıl alınır
47DD1
ReplyDelete----
----
----
----
matadorbet
----
----
----
----
bnjhgfsx
ReplyDeleteصيانة افران جدة
nfgdgddsfdsrfeg
ReplyDeleteمهندس افران جدة
Registered Nurse jobs in Australia are highly esteemed within a sophisticated healthcare system. Nurses in these positions provide exceptional patient care, administer medications, and collaborate with interdisciplinary teams to ensure optimal health outcomes. These roles offer various specializations, including emergency medicine, geriatrics, and mental health, allowing for professional growth. Competitive salaries and comprehensive benefits underscore these positions, fostering a supportive work environment. Additionally, registered nurses play a critical role in patient advocacy and education, which significantly contributes to enhanced community health and wellness. Overall, nursing in Australia promises a fulfilling and impactful career.
ReplyDeletehttps://www.dynamichealthstaff.com/registered-nurse-jobs-australia
شركة تنظيف بخميس مشيط pKeVYNo4Gf
ReplyDeleteشركة مكافحة حشرات lH8ohQ2HJF
ReplyDeleteشركة عزل اسطح بالهفوف cUn8VO00pH
ReplyDelete