SCCM – OSD – Preventing Task Sequence Reboot After Software Install

This is one that you’ll deal with sooner or later, Windows XP Service Pack 3 is a valid example (requires a reboot after install and therefore produces an exit code of 3010 or 0x80070bc2

Your task sequence will interpret the return code and act upon it by restarting your install before continuing but this may not be your desired result. To get around this you need to wrap the original program in a VBS script (or similar script) which masks the return code and produces a retval of 0 (zero) meaning all is good and no need to reboot.

 

A very simple example of this is the following code which could be called from within a task sequence and allow the ts to continue even if the returned retval was 3010:

 

Dim Retval

Retval=0

 

‘ *** Install Application. ***

Dim WSHShell

Set WSHShell =

WScript.CreateObject(“WScript.Shell”)

 

‘ open normal

and don’t wait

WSHShell.Run “notepad.exe“, 1, True

Set WSHShell = Nothing

 

‘ *** show us

what RETVAL is, unrem to see what retval = ***

MsgBox “The

actual return code was ” &retval

 

‘ *** unrem to set to

3010 for testing ***

‘retval = 3010

 

If retval = 3010

Then

MsgBox “The return code was 3010, resetting to 0″

else

MsgBox “The actual return code was ” &retval

 

WScript.Quit(Retval)

End If

 

‘ *** set

the return value to 0 anyway. ***

Retval=0

MsgBox “The

return code was reset to 0″

WScript.Quit(Retval)

 

The sample above is a script for starting your program (notepad.exe in this case but it could be an msi script or whatever), i’ve added Msgbox lines that you can rem out/in to change the behavior of the script, try it out yourself to see the results.

 

References:

 

1. http://www.myitforum.com/forums/Preventing-Task-Sequence-Reboot-After-Software-Install-with-3010-m220480.aspx

 

2. http://social.technet.microsoft.com/Forums/en-US/configmgrosd/thread/60293abd-30a8-4f9c-80d5-e83c0b822a1c

 

.

Comments are closed.