As usual in Windows we can do similar things in quote many different ways, but by taking advantage of the built-in MDT objects we can often easy the pain. Here is a sample for copying a folder, using the MDT progress bar, properties, logging and error handling.
Here is an example that copies a folder named StuffToCopy folder from Applications on your deployment server, to C:Windows\Temp on the client.
Save the script as ZTICopyFolder.wsf (Windows Script File) in your scripts folder. This is needed since we are including the components from the core utility script (ZTIUtility.vbs) from MDT.
<job id="ZTICopyFolder"> <script language="VBScript" src="ZTIUtility.vbs"/> <script language="VBScript"> Option Explicit Dim iRetVal On Error Resume Next iRetVal = ZTIProcess ProcessResults iRetVal On Error Goto 0 Function ZTIProcess() ' Declare the variables Dim sSourceFolder Dim sTargetFolder ' Define Source and Target folders sSourceFolder = oEnvironment.Item("DeployRoot") & "\Applications\StuffToCopy" sTargetFolder = "C:\Windows\Temp\StuffToCopy" oLogging.CreateEntry "Copying " & sSourceFolder & " folder to the local machine", LogTypeInfo ' Optional progess logging to the task sequence progress bar oLogging.ReportProgress "Copying " & sSourceFolder & " folder to the local machine", 20 ' Do the actual copying oFSO.CopyFolder sSourceFolder, sTargetFolder, true End Function </script> </job>