I often run into questions concerning simple file copy during a SCCM/MDT Task Sequence.  There are many ways to accomplish this, but it seams most people wind up using the good old XCOPY command, and in general there is nothing wrong with that.

When copying from a DP though, you might run into problems when copying all files and folders in the root on your source, as that points to the root of X:\windows and not the root of the package specified..

Well to work around any issues I created a small VBS script, that takes care of the copying as long as it resides in the root of the source folder. There are of cause ways around the xcopy issues, and as I mentioned other ways to copy files, but this script solution seems to work every time…

So, how to use the script.

1. Copy code from the below script to a .vbs file (or download from the bottom of  the page)

2. Place the script in the folder containing the files/folders you intend to copy, and that folder to a package.

3. In your TS, Add a Run Command Line step, and call the script from the package

In this example I created a Package called Files To Copy which contains all the files and folders I want to copy (and of cause also the script, that I call CopFiles.vbs)


In the Command line: I typed in cscript.exe CopyFiles.vbs c:\TEST

This will copy everything in the package to C:\TEST and remove the CopyFiles.vbs script.


In case I only want to copy, say two files from the package, the syntax would be:

 cscript.exe CopyFiles.vbs c:\TEST file1.txt file2.txt

This would only copy file1.txt and file2.txt to the destination c:\TEST


In case I only want to copy, one file and one folder from the package, the syntax would be:

 cscript.exe CopyFiles.vbs c:\TEST file1.txt Folder1


In case I want to copy all TXT files the syntax would be:

 cscript.exe CopyFiles.vbs c:\TEST *.txt


The script is shown below


Download “CopyFiles” CopyFiles.zip – Downloaded 8314 times – 1 KB