SRed 1 Posted November 27, 2012 Report post Posted November 27, 2012 Hi guys, For a recent client, I've had to automate the removal of Alternate Data Stream information from files, as this was causing ImageX to crash while taking a .WIM backup of critical systems. We would see the file name listed in the BDD and ZtiBackup.logs with an error code 2 next to the file name. Massive trial and error lead me to the discovery that some files with Zone Identifier or other types of Meta data can cause imageX to fail. I discovered Mark Russinovich's excellent Streams.exe tool, which is made to read and destroy ADS info, and it perfectly solves this problem. When I run it manually, all deployments complete without an issue. In the interests of automation, I've modified a .vbs file and added it to my Script Root, and yet I'm getting errors in deployment of "File not found", when the task sequence gets to that file. In addition, I've tried rendering the same commands as a .batch file, also with no success. Would you scripting professionals mind taking a look at this and letting me know if you see any errors? Thank you! Edit: I can't seem to use either uploader, so I'll just post the text of my Vbs below. <job id="Remove-DataStreams"> <script language="VBScript" src="ZTIUtility.vbs"/> <script language="VBScript"> '//---------------------------------------------------------------------------- '// Purpose: Used to Remove Alternate Data Streams/Zone Identifiers '// Usage: cscript Remove-DataStreams.wsf [/debug:true] '// Version: 1.0 - 20 Nov 2012 - Stephen OWen '// '// This script is provided "AS IS" with no warranties, confers no rights and '// is not supported by the authors or Deployment Artist. '// '// Instructions: In the MDT Application, create a source folder and copy '// this script and SysInternals Streams.exe '// '//---------------------------------------------------------------------------- '//---------------------------------------------------------------------------- '// Global constant and variable declarations '//---------------------------------------------------------------------------- Option Explicit Dim iRetVal '//---------------------------------------------------------------------------- '// End declarations '//---------------------------------------------------------------------------- '//---------------------------------------------------------------------------- '// Main routine '//---------------------------------------------------------------------------- On Error Resume Next iRetVal = ZTIProcess ProcessResults iRetVal On Error Goto 0 '//--------------------------------------------------------------------------- '// '// Function: ZTIProcess() '// '// Input: None '// '// Return: Success - 0 '// Failure - non-zero '// '// Purpose: Perform main ZTI processing '// '//--------------------------------------------------------------------------- Function ZTIProcess() oLogging.CreateEntry "Remove-DataStreams: Preparing to remove ADS Information", LogTypeInfo ' Disable Zone Checks oEnv("SEE_MASK_NOZONECHECKS") = 1 ' Removal of ADS values begins here ' iRetVal = oUtility.RunWithHeartbeat("streams.exe /accepteula -d -s "C:\Documents and Settings"") ' oLogging.CreateEntry "Remove-DataStreams: Completed Removal of ADS in C:\Documents and Settings" iRetVal = oUtility.RunWithHeartbeat("streams.exe /accepteula -d -s C:\") oLogging.CreateEntry "Remove-DataStreams: Completed Removal of ADS in C:\" if (iRetVal = 0) or (iRetVal = 3010) then ZTIProcess = Success Else ZTIProcess = Failure oLogging.CreateEntry "Remove-DataStreams: Error processing script Check the log." End If ' Enable Zone Checks oEnv.Remove("SEE_MASK_NOZONECHECKS") oLogging.CreateEntry "Remove-DataStreams: Return code from command = " & iRetVal, LogTypeInfo oLogging.CreateEntry "Remove-DataStreams: Finished Removal", LogTypeInfo End Function </script> </job> Quote Share this post Link to post Share on other sites
MathieuAA 0 Posted November 27, 2012 Report post Posted November 27, 2012 Hi SRed, So you put this script in the script folder right? Where did you put streams.exe? In order to launch streams.exe you have to provide the path to this file or you must let the file in the script folder. Quote Share this post Link to post Share on other sites
SRed 1 Posted November 28, 2012 Report post Posted November 28, 2012 Thanks for the reply. I placed both the script and the exe in the \\Mdt\DeploymentShare$\Scripts folder. This is the value of %ScriptRoot%, right? Quote Share this post Link to post Share on other sites
SRed 1 Posted November 28, 2012 Report post Posted November 28, 2012 Turns out that I actually had the script in the %DeployRoot% folder, and hadn't updated the WinPE image. On top of that, I also had a number of errors in my script, which is why I never saw any messages about the script running in my BDD and SMSTS logs. I've since fixed it, thank you anyway! Quote Share this post Link to post Share on other sites