Asked by:
MDT Custom .wsf script in task sequence failure

-
Hi guys
I am currently setting up a deployment in MDT. I have configured a vanilla win7.wim deploy and capture task. During the deployment I have a custom script within the task sequence. I have used a script (Johan wrote it) to copy a folder from the deploy root to the "C:\Windows\Setup" folder.
Custom script location and name: "DeploymentRoot\Scripts\CustomScripts\CopyDeploymentAssets1.wsf"
Location where folder to copy is: "DeploymentRoot\Deployment Assets\Scripts"
Script:
<job id="CopyDeploymentAssets1.wsf"> <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") & "\Deployment Assets\Scripts" sTargetFolder = "C:\Windows\Setup" 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>
CL in task sequence:
cscript.exe "%scriptroot%\CustomScripts\CopyDeploymentAssets1.wsf"
Every time i deploy, the task sequence errors out
BDD Log: http://snipt.org/Amjd3
Failed to run the action: Copy Additional Deployment Files 1.
Incorrect function. (Error: 00000001; Source: Windows TSManager 6/7/2013 4:39:02 PM 2648 (0x0A58)"SMS Log: http://pastebin.com/pLvhi6nC
Does anyone have any suggestions why this is? I have tried adding in the task sequence:
Commandline: cscript.exe "\CustomScripts\CopyDeploymentAssets1.wsf"
Start In: %scriptroot%
But this makes no difference
Question
All replies
-
Error 1 is usually some type of syntax error.
rem out the On error Resume next line and rerun it, it may kick out an error telling you what line is incorrect.
also the space in "Deployment assets" might be tripping you up. Sometimes I have to enclose lines like that in quotes, sometimes not, depending on how it gets parsed.
If so, try changing it to
sSourceFolder = Chr(34) & oEnvironment.Item("DeployRoot") & "\Deployment Assets\Scripts" & Chr(34)
-
Hi JoeZeppy
Thanks for your suggestions
I tried renaming the "Deployment Assets" folder to "DeploymentAssets" to remove the possibility of an issue with a space. This made no difference. I also rem'd out the on error resume line. Unfortunately the error is still there and no more info in logs.
I have tested some other scripts in my task sequence that do things such as a delete files or write to reg keys, and they have the same problem/error......
-
Hi Tee-Eff,
I am not testing, but your script seems to locate under sub folder. So ZTIutility is not there.
Modify your line 2 like this and try it.
<script language="VBScript" src="..\ZTIUtility.vbs"/>
- Proposed as answer by DCtheGeekMicrosoft employee, Editor Saturday, June 22, 2013 8:01 PM
-
Norihiko is right.
If your script were in the root of the scripts folder it should work, but since you have it in a custom folder the line should look like
<script language="VBScript" src="..\ZTIUtility.vbs"/>
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
-