Copy Users Data from one computer to another

kyleshire
kyleshire used Ask the Experts™
on
I have the senario below and would like any assistance.

- I have 40 users moving from one workstation to another.
- I have a list of their old and new computer name.
- I logon as the users already on the new 40 workstations to create the local profiles.

I would like a simple script to copy the user's profile like Document, Favorites, Desktop from their old workstation to the new ones.
Perhaps create two text files of the user name with old computer and new computer. The script will read the old computer text file first as IF userA, copy the data from OLD computer1, go to text file for new computer, and compare IF  UserA restore the file to the NEW Computer1.

These are my thoughts, but do not know how to write into a script or any advise would greatly appreciated.

UserA     OLD COMPUTER1
UserB     OLD COMPUTER2

UserA     NEW COMPUTER1
UserB     NEW COMPUTER2
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jose Gabriel Ortega CastroCEO Faru Bonon IT /Top Rated Freelancer on Upwork / Photographer
Awarded 2018
Distinguished Expert 2018

Commented:
Here you go one already created that doesn't several things as well:

https://gallery.technet.microsoft.com/scriptcenter/Copy-Files-from-folderA-to-29710ef9
End-user support
Commented:
This does what you need.
- Make a file users.txt. Add this code. Add a line for each user:
user1,oldpcuser1,newpcuser1
user2,oldpcuser2,newpcuser2
user3,oldpcuser3,newpcuser3

Open in new window

- Make a file CopyUserData.bat. Add this code.
- Open a CMD window as domain admin.
- Run CopyUserData.bat
Note: It is currently in test mode for visual debugging reasons. When you are happy that's what you want, remove the echo prefixes:

@echo off
setlocal EnableDelayedExpansion

set fnusers=users.txt
for /f "tokens=1-3 delims=," %%a in ('type "%fnusers%"') do (
	rem Add more lines for each folder as needed...
	echo robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\%%b\c$\users\%%a\documents" "\\%%c\c$\users\%%a\documents"
	echo robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\%%b\c$\users\%%a\Favorites" "\\%%c\c$\users\%%a\Favorites"
	echo robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\%%b\c$\users\%%a\Desktop " "\\%%c\c$\users\%%a\Desktop"
)

Open in new window


Example result:
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser1\c$\users\user1\documents" "\\newpcuser1\c$\users\user1\documents"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser1\c$\users\user1\Favorites" "\\newpcuser1\c$\users\user1\Favorites"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser1\c$\users\user1\Desktop " "\\newpcuser1\c$\users\user1\Desktop"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser2\c$\users\user2\documents" "\\newpcuser2\c$\users\user2\documents"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser2\c$\users\user2\Favorites" "\\newpcuser2\c$\users\user2\Favorites"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser2\c$\users\user2\Desktop " "\\newpcuser2\c$\users\user2\Desktop"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser3\c$\users\user3\documents" "\\newpcuser3\c$\users\user3\documents"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser3\c$\users\user3\Favorites" "\\newpcuser3\c$\users\user3\Favorites"
robocopy /e /np /ndl /nfl /r:0 /w:0 /dcopy:t /log+:robocopyLog.txt "\\oldpcuser3\c$\users\user3\Desktop " "\\newpcuser3\c$\users\user3\Desktop"

Open in new window

Top Expert 2013

Commented:
There is a tool Profwiz that is great for migrations such as this.  Using the GUI, one user at a time is free, but they have a paid scripted version you might like to look at:
https://www.forensit.com/domain-migration.html
SCCM Can carry out User State Migrations, would it be worth while looking to implement that as a solution? A couple of days work to set it up, but it would work better than manual migrations.
NVITEnd-user support

Commented:
Author's question: I would like a simple script to copy the user's profile like Document, Favorites, Desktop from their old workstation to the new ones....

... has been answered by NVIT.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial