none
How to copy an entire folder structure to a local drive

    Question

  • Hello,

    I'm attempting to copy an entire folder structure from a network drive to a pc's local drive using a GPP.  Copying a single folder or multiple files is easy but I can't seem to figure out how to copy a folder, it's sub-folders and all the files they contain.

    Any advice would be greatly appreciated...

    Tuesday, April 27, 2010 8:07 PM

Answers

  • Thanks for the quick response.

    I was afraid that was going to be the answer...

    I have a batch file already written the does what I'm trying to accomplish.  I know how to trigger it using the Scripts option under policies.  Do you know of a way to trigger the file using Preferences so I can use Item Level Targeting to control how it's executed?

    Thanks again,

    Paul

    • Marked as answer by psherry Thursday, April 29, 2010 7:23 PM
    Tuesday, April 27, 2010 8:47 PM

All replies

  • Hi,

     I don't believe this is possible, you can copy multiple files within a single folder only. I would recommend using a script triggered by Group Policy instead.

     

    Thanks,

    Guy

    Tuesday, April 27, 2010 8:13 PM
  • Guy is right, it is not possible with GPP.

    Maybe this is due to safety of your network...
    Imagine you set up a copy with all subfolders and somebody accidentaly adds lots of content to the source folder
    without knowing about the GPP item. A copy action with lots of network traffic would happen.
    And don't forget, GPP items are applied in repeated intervals (by default every 90 mintes), so this easily might mess up your network infrastructure.

    A good helper for copy jobs is still "robocopy".

    My opinion on this is the following:
    Copying many files to a client for me is more a software installation action,
    so I usually use my software deployment methods for this and not GP or GPP.


    Patrick
    Tuesday, April 27, 2010 8:44 PM
  • Thanks for the quick response.

    I was afraid that was going to be the answer...

    I have a batch file already written the does what I'm trying to accomplish.  I know how to trigger it using the Scripts option under policies.  Do you know of a way to trigger the file using Preferences so I can use Item Level Targeting to control how it's executed?

    Thanks again,

    Paul

    • Marked as answer by psherry Thursday, April 29, 2010 7:23 PM
    Tuesday, April 27, 2010 8:47 PM
  • Hi,

     You can use GPPs to create a scheduled task that runs the script. Also, depending on what item level targeting rule you want to use, you might be able to use a WMI filter or add the condition to the script.

     

    Thanks,

    Guy

    Tuesday, April 27, 2010 8:58 PM
  • I got my script to run through a scheduled task as you mentioned above and it is copying files.  It doesn't ever terminate though - the status stays at "Running".

    Is that to be expected or am I missing something?

    Thanks,

    Paul

    Tuesday, April 27, 2010 10:37 PM
  • Hi Paul,

     It's not expected. You can typically run the script in a command window to see anything it might be doing. If doing a file copy, make sure that the right switches are configured to prevent any prompts or other user interaction.

     

    Feel free to post the script if you us to review it.

     

    Thanks,

    Guy

    Wednesday, April 28, 2010 4:05 PM
  • Hi Guy,

    I just wanted to thank you for your help - I still have a lot of logic to work through to get everything working but you led me down the right path with scheduled tasks.

    Have a good afternoon and thanks again,

    Paul

    Thursday, April 29, 2010 7:23 PM
  • Guy,

    I have one more question for you...

    When I create the task in GPMC I'm logged in as a domain admin and assign the GPO to my account.  The task gets created on my test PC and runs great.  So, all is good when I use an account with local admin rights.

    When I created a new test user with normal user rights, the task didn't appear.  I bumped the rights up to power user and then local admin.  The task finally appeared with admin rights.

    I then put the user back to normal rights and granted the account full rights to the c:\windows\tasks folder.  Now, the task will appear (with non-admin rights) and it says it ran (result 0x0) but it doesn't actually do anything.

    If I copy the command line from the task and paste it into a cmd window, it works fine.

    After more testing, including granting a user Domain Admin rights, I've concluded that the only account that it will actually do anything under is mine.

    The log file shows "Result: The task completed with an exit code of (0)"

    I've been beating on this for hours and I've run out of things to try.

    Do you have any suggestions?

    Friday, April 30, 2010 1:41 PM
  • Have you tried setting the task to run as SYSTEM ?

    Friday, April 30, 2010 2:27 PM
  • (in GPMC) I just tried setting the user to SYSTEM and then set it to NT AUTHORITY\SYSTEM but it won't let me off the page because it wants a password.  As I understand it, SYSTEM doesn't have a password or at least not one you can set or use - is that right?

    Thanks Robert

    Friday, April 30, 2010 3:09 PM
  • In my experience, the return code of the task often only indicate that it successfully launched the command and no error was returned.

    If you're using a user policy, the user will need access to create tasks which it sounds like you've already set up. As far as the task running successfully, does it work correctly if you give admin credentials for the task to run under. Is that an acceptable solution?

    If not, can you add some logging to the command line to get more error information - if its just a copy command, maybe pipe the results to a file?

     

    Thanks,

    Guy

    Friday, April 30, 2010 4:26 PM
  • This is really strange behaviuor of the File copy capabilities. I'm trying to copy a local folder to a new folder. If rename was an option I could do that, but it's not possible. Workaround has been to create a folder in one step and to copy files in another step. But subfolders isn't included in the copy?! So, make new folders and new file copy steps!? Guess it's back to login scripts again. These limitations make no sense at all.
    Monday, March 12, 2012 12:00 PM
  •  
    > This is really strange behaviuor of the File copy capabilities. I'm
    > trying to copy a local folder to a new folder. If rename was an option
    > I could do that, but it's not possible. Workaround has been to create
    > a folder in one step and to copy files in another step. But subfolders
    > isn't included in the copy?! So, make new folders and new file copy
    > steps!? Guess it's back to login scripts again. These limitations make
    > no sense at all.
     
    You're trying to do that with Group Policy Preferences, I assume? I
    recommend ignoring the "Files" extension and stay with startup and logon
    scripts leveraging the advantages of robocopy and asynchronous
    processing - the GPP CSE "Files" is one of the most ridiculous things I
    ever saw... Shortly behind Internet Explorer Maintenance (-:
     
    sincerely, Martin
     

    NO THEY ARE NOT EVIL, if you know what you are doing: Good or bad GPOs?
    Wenn meine Antwort hilfreich war, freue ich mich über eine Bewertung! If my answer was helpful, I'm glad about a rating!
    Monday, March 12, 2012 8:04 PM