none
How to programmatically determine whether task sequence is running RRS feed

  • Question

  • Using group policy I'm deploying a scheduled task to Win 10 clients to restart them nightly.  When my clients finish imaging they sit at the finish screen, I have to click Finish, but if they finish in the evening my nightly restart task restarts them and I don't get to confirm they finished without error. 

    Is there a way to tell with the registry, with a file, or some other way, when the task sequence is complete, ie I've clicked Finish?  I'd then edit my restart task to not apply unless I've clicked Finish.

    Monday, April 30, 2018 3:34 PM

Answers

  • In your restart script, have it look and see if C:\MININT is present.  If that folder is present, have the script skip the reboot for the night.

    You could also set SkipFinalSummary=YES in your CS.ini.  This means you wont have to click Finish at the end of the deployment.  It would only display the FinalSummary screen if there was an error during the deployment.

    LawsonT

    • Marked as answer by J. Wall Tuesday, May 1, 2018 6:48 PM
    Tuesday, May 1, 2018 2:43 AM
  • could you add a step or 2  to your task sequence to write a harmless registry entry ?

    Using our existing registry location - HKLM\Software\Microsoft\Deployment 4  

    Maybe create a DeploymentCompleted  dword value, have it set the value to 0 initially when the deployment starts, then change it to 1 at the very end of your sequence - then query that value??  Just thinking out loud here..


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com


    • Edited by Tim Magnuson Monday, April 30, 2018 4:37 PM
    • Marked as answer by J. Wall Tuesday, May 1, 2018 8:58 PM
    Monday, April 30, 2018 4:37 PM

All replies

  • Do you have SLShare and SLShareDynamicLogging enabled and configured in your rules.ini?

    It's not exactly ideal, but at least you could go back and verify which clients completed and which ones didn't.

    The very end of my task sequence copies all the log files over to my mdt server and notates the log of a final entry.  (might be able to script something to look for this?)

    Log:

    Cleaning up C:\MININT directory.

    Cleaning up TOOLS, SCRIPTS, and PACKAGES directories.

    Removing C:\MININT folder (final log entry)

    Let me keep thinking about that one..


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com

    Monday, April 30, 2018 3:45 PM
  • Thanks for the reply Tom. SLShareDynamicLogging continually writes the logs to the server I believe, not just at the end of the ts, but no, I do not have the logs going to the server.  I've done that in the past but it caused problems, I can't remember the details now though.

    I was originally thinking there'd be a value in HKLM\SOFTWARE\Microsoft\Deployment 4 I could look for but it seems nothing changes in there after I click Finish

    Monday, April 30, 2018 4:02 PM
  • correct - the SLShareDynamicLogging option is a real-time streaming log, for lack of a better term.

    The only reason I brought this up is I use it religiously to check the status of my deployments.  It also helps me spot problems so I don't have to sit through an entire deployment only to restart it because something didn't go right.

    I'm looking at one of my latest deployed clients and I see a 'Deployment Timestamp' string value under HKLM\Software\Microsoft\Deployment 4

    I've never paid attention to this value before, but you're saying it doesn't change upon completion?  Like the timestamp is created at the beginning of the process?


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com

    Monday, April 30, 2018 4:27 PM
  • could you add a step or 2  to your task sequence to write a harmless registry entry ?

    Using our existing registry location - HKLM\Software\Microsoft\Deployment 4  

    Maybe create a DeploymentCompleted  dword value, have it set the value to 0 initially when the deployment starts, then change it to 1 at the very end of your sequence - then query that value??  Just thinking out loud here..


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com


    • Edited by Tim Magnuson Monday, April 30, 2018 4:37 PM
    • Marked as answer by J. Wall Tuesday, May 1, 2018 8:58 PM
    Monday, April 30, 2018 4:37 PM
  • First, I apologize for calling you Tom... I read your signature then went about replying thinking you were a Tom.

    Yes the time stamp is set at the start and does not change according to my testing.  Yes, writing a value at the end, or at the start and changing it at the end, would work.  I'm not sure where the finish screen appears in the task sequence, I believe it's not the very last step in the task sequence though, I'll try to figure that out and post my results.

    Monday, April 30, 2018 4:47 PM
  • No worries about the name, I've been called worse =)

    Looks like the exe that generates the 'Finish Screen' is called OSDResults.exe (in your <MDTInstall folder>\Tools\OSDResults) 

    That exe is actually called by bootstrapper.vbs in the same folder.

    I'll do some more looking.


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com

    Monday, April 30, 2018 5:25 PM
  • In your restart script, have it look and see if C:\MININT is present.  If that folder is present, have the script skip the reboot for the night.

    You could also set SkipFinalSummary=YES in your CS.ini.  This means you wont have to click Finish at the end of the deployment.  It would only display the FinalSummary screen if there was an error during the deployment.

    LawsonT

    • Marked as answer by J. Wall Tuesday, May 1, 2018 6:48 PM
    Tuesday, May 1, 2018 2:43 AM
  • why didn't i think of that!?!?!  excellent idea!

    I hate over-thinking things.


    Tim Magnuson | MCTS, MCITP | MCCA 2011 |
    Ok, so I changed my name...you can still call me Tom if you like. It's a...jump...to conclusions...mat.
    My Blog Site: http://tmagnuson.wordpress.com

    Tuesday, May 1, 2018 1:28 PM
  • It's not actually a script I'm using but a policy preference scheduled task which simply runs shutdown -r at 2am.  I know I could use SkipFinalSummary=YES but I like seeing the Finish screen at the end to confirm the imaging worked properly.

    I've now added some item-level targeting to the preference item to NOT create the scheduled task if C:\MININT exist, thanks for the idea Lawson.

    Tuesday, May 1, 2018 6:47 PM
  • Glad to help!
    Tuesday, May 1, 2018 8:44 PM