Jump to content


Sign in to follow this  
anyweb

How can I copy files from a package

Recommended Posts

Let's say you want to copy some files from a package to your target computer, should be simple enough right ?

 

In the following Task Sequence, copying files from packages - access.xml

 

copying files from packages - access.xml

 

we reference a package (called copy_files) which contains some blank files and folders

 

copy_files.zip

 

We have two groups in this simple task sequence, the first group copies all files from a package to a directory on your target computer (the computer that you run the task sequence on).

 

copy all files in a package to somedir.jpg

 

The first step in the group creates the target folder if it doesn't exist, via a command line

 

cmd.exe /c md c:\somedir

 

make somedir.jpg

 

To check if the folder already exists, you have to look at the options tab of that step

 

if some dir exists.jpg

 

The second step actually copies the files by referencing our copy_files package, the clever part here is the .\ infront of our path.

 

copy all files from package to somedir.jpg

 

so the command line to do the copying is as follows

 

xcopy.exe ".\*.*" "c:\somedir" /D /E /C /I /Q /H /R /Y /S

 

 

 

The second group in the task sequence is similar to the first except that it creates somedir2 and it only copies the TXT files from our selected package. (This is deliberate so that you can see what happens next..)

 

 

copy all txt files from our package.jpg

 

Note: In the screenshot of the step above, I am deliberatly NOT including the .\ in front of the path, this is to show you how an advertisements distribution points settings can change the way command lines function.

 

the xcopy command in the second group is as follows

 

xcopy.exe "*.txt" "c:\somedir2" /D /E /C /I /Q /H /R /Y /S

Share this post


Link to post
Share on other sites


Advertise the Task Sequence

 

Import the task sequence into configmgr and create the copy_files package using the package included in the post above. don't forget to distribute that package to your distribution points. Once ready, we will then advertise our Task Sequence.

 

In Task Sequences, select the imported task sequence, right click on it and choose Advertise

 

advertise ts.jpg

 

When the New Advertisement Wizard begins, select your All Windows XP collection (or whichever one you are testing with) and click next

 

new advertisement wizard.jpg

 

leave schedule as it is, make no changes

 

schedule.jpg

 

For distribution settings, choose access content directly from a distribution point when needed by the running task sequence

 

access content directly from a distribution point when needed by the running task sequence.jpg

 

for Interaction, choose show the task sequence progress

 

show the task sequence progress.jpg

 

click next through the wizard to finish.

Share this post


Link to post
Share on other sites

Duplicate the Task Sequence

 

Right click on our selected task sequence again, but this time choose Duplicate

 

you will be informed when the duplication is done, click Ok.

 

dup done.jpg

 

Right click on the task sequence, choose properties and change the name to copying files from packages - download

 

We now have our second Task Sequence and it is identical to the first except for the name (the reason of which will become clear soon).

 

two task sequences.jpg

 

 

Create a New Advertisement

 

Create a new advertisement for the copying files from packages - download task sequence as we did above except for the distribution settings do as follows:-

 

Choose the following setting download content locally when needed by running task sequence

 

download content locally when needed by running task sequence.jpg

Share this post


Link to post
Share on other sites

Run the first Advertisement from RAP

 

Now that we have done all the hard work, let's test it on the client, open up RAP (Run Advertised Programs) and select the first Advertisement which is called copying files from packages - access

 

running action - copy all txt files from all packages to somedir2 access.jpg

 

Let the advertisement complete and then check your c:\ for the results

 

when finished we'll see our two directories created,

 

two dirs.jpg

 

the first dir (somedir) should contain all files from the copy_files package, and indeed it does

 

files from copy_files.jpg

 

We would naturally expect the second dir (somedir2)to only contain the TXT files from the copy_files package, but to our surprise it contains possibly hundreds of folders all marked with your site code, infact, these folders are every single package on your site server (and thankfully only the TXT files are copied, now do you see why I selected only the TXT files ;))

 

all packages from site server.jpg

Share this post


Link to post
Share on other sites

Run the second advertisement from RAP

 

Now that we've seen what the access content directly from Distribution Points setting does in relation to file copy, let's run the other advertisement, but before we do, delete the somedir and somedir2 directories

 

delete.jpg

 

Choose the copying file from packages - download task sequence and run.

 

copying file from packages - download.jpg

 

this task sequence will execute much quicker than the first

 

in progress.jpg

 

when done, check c:\somedir, it contains all files and folders as we would expect from the package

 

somedir.jpg

 

and finally check c:\somedir2

 

note how it ONLY contains the text files from our copy_file package, exactly as we expected originally, and this is all down to our Distribution Point settings in our Advertisement !

 

somedir2.jpg

 

Interesting huh ? try it for yourself and share your results please

 

cheers

niall

Share this post


Link to post
Share on other sites

Really Interesting...... I think it downloads all the content packages from DP based on the Criteria given in the commandline but also it copies all the DP content even if the folder doesnt have .txt files. In this case(with option access content directly ),is there any importance or usage for the package (copy files package) used ?

 

will this happen to all the advertised TS on the clients if we select access content directly ?

 

 

 

Share this post


Link to post
Share on other sites

How would you change this task sequence to work with a task sequence that is being used to image a machine? It seems that it doesn't like writing files to any place other than the public user directory.

Share this post


Link to post
Share on other sites

I am trying to use this method during OSD to copy a files onto the local HD. Does the target computer need to be joined to the domain for this method to work?

Share this post


Link to post
Share on other sites

No it doesn't has to be domain joined. It only needs to be able to communicate with ConfigMgr (MP/DP) and a network access account has to be configured in ConfigMgr to access the DP.

Share this post


Link to post
Share on other sites

No it doesn't has to be domain joined. It only needs to be able to communicate with ConfigMgr (MP/DP) and a network access account has to be configured in ConfigMgr to access the DP

Can this be done during OSD?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...