Skip to content

Instantly share code, notes, and snippets.

@Diagg
Last active July 17, 2019 18:48
Show Gist options
  • Select an option

  • Save Diagg/b159cfdc37b4bf9acfa71ce29afc0d2b to your computer and use it in GitHub Desktop.

Select an option

Save Diagg/b159cfdc37b4bf9acfa71ce29afc0d2b to your computer and use it in GitHub Desktop.
This script for MDT/SCCM demonstrate how to reboot to the same Task Séquence step wether you are on WinPE or Windows.
<job id="BIOSCheck">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
Option Explicit
RunNewInstance
Class TestReboot
Function Main
oLogging.CreateEntry "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" , LogTypeInfo
If oEnvironment.Exists("RebootCount") then
oEnvironment.Item("RebootCount") = oEnvironment.Item("RebootCount") + 1
Else
oEnvironment.Item("RebootCount") = 1
End If
oLogging.CreateEntry "Preparing to reboot for the " & oEnvironment.Item("RebootCount") & " Time" , LogTypeInfo
oUtility.SafeSleep 15000
If oEnvironment.Item("RebootCount") <= 3 then
If oEnvironment.Item("OSVersion") = "WinPE" Then
oEnvironment.Item("SMSTSRebootRequested") = "WinPE"
Else
oEnvironment.Item("SMSTSRebootRequested") = "true"
End If
oEnvironment.Item("SMSTSRetryRequested") = "true"
oLogging.CreateEntry "Reboot intitated, quit" , LogTypeInfo
Else
oLogging.CreateEntry "Looping Out of reboot, continuing TS execution!" , LogTypeInfo
End If
oLogging.CreateEntry "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" , LogTypeInfo
Main = SUCCESS
End Function
End class
</script>
</job>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment