copy profile to network share

Posted on 2006-05-26
Last Modified: 2012-08-13
I am migrating my users to new computers (50+ users) and I would like them to run a batch file that will copy their user profile to their home directory (P:).  Below are the contents of my batch file, which removes temporary internet files and then copies the rest to the P:\profile directory.  

rd "C:\Documents and Settings\%username%\Local Settings\Temporary Internet Files" /s /q
xcopy "C:\Documents and Settings\%username%" p:\profile\ /E /I /H /O /Y /C

This works fine as an administrator, or if I do these items by hand as a user these work, but running via the batch file it does not work.  I get an access denied, can't create p:\profile, and then can't find *.*

Any help would be great.

Question by:glennjbrown
    LVL 13

    Accepted Solution

    first of all make sure P:\Profile have share permissions and NTFS permissions set correctly.

    Check that NTFS permissions is set to Domain users Read/Write/Modify.

    Since you can do it with administrator, NTFS permissions could be the only thing stopping it from happening.

    Author Comment

    This is the users home directory, and through windows they can do any tasks within the P:\ drive (R,W,X,D)

    LVL 3

    Expert Comment

    While you are logged in as administrator can you copy their profiles to a share that they can move them into their home drive from?  While the user is logged in the profile is being used and locked files can't be copied or moved.
    LVL 1

    Expert Comment

    You could setup a share with owner creator rights on your server.

    Then change all the users accounts to be roaming accounts and set it to upload the users profiles to the profile share. Next time they log off it will do it automatically.

    Exclude the Temporay internet files folder from within the local machine policy cause you dont need to upload that really.
    LVL 13

    Expert Comment

    Yes, files will be locked if user is logged on.

    What you can do it to make a computer startup script.

    This script will run with system rights, and can copy all the profiles to any network folder.

    only problem is that username variable will not be set at this time.

    You can use this command to extract the username from the folder list

    dir /b | find /v "Administrator" | find /v "All Users" > profilename.txt

    This will copy the names of all the user profiles in profilename.txt file.

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now