1. Add a step in Task Sequence to create a “.tag” file named after the OsdComputerName, which will be later used to determine the deployment duration.
Command Line: cmd /c echo. > “Z:\Logs\%OsdComputerName%.tag”
2. Add a Task Sequence step to sync time with Deployment Server during the State Restore phase.
Command Line: cmd /c net time \\192.168.56.1 /set /y
3. Update the LTICleanup.wsf script to add “DeploymentDuration” to results.xml file.
~ line 225
' Pull Deployment Time from ComputerName.tag file.
sFilePath = oEnvironment.Item("DeployRoot") & "\Logs\" & oEnv("ComputerName") & ".tag"
If oFSO.FileExists(sFilePath) Then
set oFile = oFSO.GetFile(sFilePath)
sMinutesRunning = datediff("n", oFile.DateLastModified, now)
Else
sMinutesRunning = sFilePath & " not found"
End If
' Save the results
Set oResults = oUtility.CreateXMLDOMObject
oResults.LoadXml "<?xml version=""1.0"" ?><Results><Errors>" & iErrors & "</Errors><Warnings>" & _
iWarnings & "</Warnings><RetVal>" & oEnvironment.Item("RETVAL") & _
"</RetVal><DeploymentType>" & oEnvironment.Item("DeploymentType") & _
"</DeploymentType><Messages><![CDATA[" & sBuffer & "]]></Messages>" & _
"<DeploymentDuration>" & sMinutesRunning & "</DeploymentDuration>" & _
"</Results>"
oResults.Save oEnv("TEMP") & "\Results.xml"
oResults.Save sArchiveDir & "\DeploymentLogs\Results.xml"
4. Update Summary_scripts.vbs and Summary_Definition_ENU.xml to Display Deployment Duration.
Lines added to Summary_scripts are marked below.
' // ***************************************************************************
' //
' // Copyright (c) Microsoft Corporation. All rights reserved.
' //
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File: Summary_scripts.vbs
' //
' // Version: 6.3.8443.1000
' //
' // Purpose: Scripts to initialize and validate summary wizard
' //
' // ***************************************************************************
Option Explicit
Dim iErrors
Dim iWarnings
Dim sBuffer
Dim sDeploymentType
'////////////
Dim iDeploymentDuration
'\\\\\\\\\\\\
Function InitializeSummary
Dim oResults
Dim iRetVal
' Load the results
If oFSO.FileExists(oEnv("TEMP") & "\Results.xml") then
Set oResults = oUtility.CreateXMLDOMObjectEx(oEnv("TEMP") & "\Results.xml")
iErrors = CInt(oUtility.SelectSingleNodeString(oResults, "//Errors"))
iWarnings = CInt(oUtility.SelectSingleNodeString(oResults, "//Warnings"))
sBuffer = oUtility.SelectSingleNodeString(oResults, "//Messages")
iRetVal = oUtility.SelectSingleNodeString(oResults, "//RetVal")
sDeploymentType = oUtility.SelectSingleNodeString(oResults, "//DeploymentType")
'////////////
iDeploymentDuration = oUtility.SelectSingleNodeString(oResults, "//DeploymentDuration")
'\\\\\\\\\\\\
Else
iErrors = 0
iWarnings = 1
sBuffer = "Unable to locate the Results.xml file needed to determine the deployment results. "
sBuffer = sBuffer & "(This may be the result of mismatched script versions. Ensure all boot images have been updated.)"
End if
' If this is a replace, then modifiy the title
If sDeploymentType = "REPLACE" then
NormalTitle.style.display = "none"
ReplaceTitle.style.display = "inline"
End if
' Set the background color based on the return code
If iRetVal = "0" or iRetVal = "" then
If iErrors > 0 or iWarnings > 0 then
MyContentArea.style.backgroundColor = "yellow"
End if
Else
MyContentArea.style.backgroundColor = "salmon"
End if
' Update the dialog
ErrorCount.InnerText = CStr(iErrors)
WarningCount.InnerText = CStr(iWarnings)
optionalWindow1.InnerText = sBuffer
'////////////
DeploymentDuration.InnerText = iDeploymentDuration
'\\\\\\\\\\\\
buttonCancel.disabled = true
End Function
Summary_Definition_ENU.xml changes are also marked below.
<?xml version="1.0" encoding="utf-8" ?>
<!--
' // ***************************************************************************
' //
' // Copyright (c) Microsoft Corporation. All rights reserved.
' //
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File: Summary_Definition_ENU.xml
' //
' // Version: 6.3.8443.1000
' //
' // Purpose: Display summary results for a Lite Touch deployment
' //
' // ***************************************************************************
-->
<Wizard>
<Global>
<CustomStatement><![CDATA[ document.title = "Deployment Summary" ]]> </CustomStatement>
<CustomStatement><![CDATA[ window.resizeTo 700,500 ]]> </CustomStatement>
<CustomStatement><![CDATA[ window.moveTo Window.screen.width/2 - 700/2, Window.screen.height/2 - 500/2 ]]> </CustomStatement>
<Initialization>Summary_Scripts.vbs</Initialization>
<HideNavigation>true</HideNavigation>
</Global>
<Pane id="Success">
<Condition><![CDATA[ UCase(Property("SkipFinalSummary")) <> "YES" and Property("RetVal") = "0" or Property("RetVal") = "" ]]></Condition>
<ButtonNext>
<Label><![CDATA[<button accesskey=F id=buttonNext language=vbscript onclick=ButtonNextClick><U>F</U>inish</button>]]></Label>
</ButtonNext>
<ButtonPrev>
<Label><![CDATA[<button accesskey=B id=buttonPrev style='display: none;' onclick="ButtonBackClick"><U>B</U>ack</button>]]></Label>
</ButtonPrev>
<Body>
<![CDATA[
<H1 id=NormalTitle>Operating system deployment completed successfully.</H1>
<H1 id=ReplaceTitle style="display: none;">The user state capture was completed successfully.</H1>
<p>The computer is now ready to use.</p>
<p>During the deployment process, <span id=ErrorCount>0</span> errors and <span id=WarningCount>0</span> warnings were reported.</p>
<p>Deployment has been running for approximately <span id=DeploymentDuration>0</span> minutes.</p>
<p>
<input id=MoreInfo src=plusicon.gif type=image onclick="javascript:HideUnHideCmdWindow(optionalWindow1);" />
<label onclick="javascript:MoreInfo.click();" >Details ...</label>
<span id=optionalWindow1 style="" class=LightColoredBox></span>
</p>
]]>
</Body>
<Initialization><![CDATA[ InitializeSummary ]]></Initialization>
</Pane>
<Pane id="Failure">
<Condition><![CDATA[ Property("RetVal") <> "0" and Property("RetVal") <> ""]]></Condition>
<ButtonNext>
<Label><![CDATA[<button accesskey=F id=buttonNext language=vbscript onclick=ButtonNextClick><U>F</U>inish</button>]]></Label>
</ButtonNext>
<ButtonPrev>
<Label><![CDATA[<button accesskey=B id=buttonPrev style='display: none;' onclick="ButtonBackClick"><U>B</U>ack</button>]]></Label>
</ButtonPrev>
<Body>
<![CDATA[
<H1 id=NormalTitle>Operating system deployment did not complete successfully.</H1>
<H1 id=ReplaceTitle style="display: none;">The user state capture did not complete successfully.</H1>
<p>Please review the log files to determine the cause of the problem.</p>
<p>During the deployment process, <span id=ErrorCount>0</span> errors and <span id=WarningCount>0</span> warnings were reported.</p>
<p>
<input id=MoreInfo src=plusicon.gif type=image onclick="javascript:HideUnHideCmdWindow(optionalWindow1);" />
<label onclick="javascript:MoreInfo.click();" >Details ...</label>
<span id=optionalWindow1 style="display=none;" class=LightColoredBox></span>
</p>
]]>
</Body>
<Initialization><![CDATA[ InitializeSummary ]]></Initialization>
</Pane>
</Wizard>
Updated source files can also be accessed here: https://github.com/brianfgonzalez/Scripts/tree/master/Deployment%20Duration
/BG