Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


robocopy or powershel to migrate home folders

Posted on 2016-09-08
Medium Priority
Last Modified: 2016-10-28
dear experts

I have over 100 home folders I need to migrate ( leave no copy behind) a new folder called "migrated_users" in a new folder in the same volume

is it possible to take ownership of users' home folders and putting them in a new folder with robocoy or powershell?

I have a list of users in a csv file with their samaccoutnames that script needs to look and   find their home folders  in a share (\\servername\sharename\home) and then place them in a new folder (\\servername\sharename\home\migrated_users)  

Question by:kuzum
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 30

Expert Comment

ID: 41789897
You should be able to run robocopy in an elevated administrator command prompt:

robocopy \\servername\sharename\home \\servername\sharename\home\migrated_users /mir /copyall

Are you having access problems?

Author Comment

ID: 41789908
no access problems but would be better to avoid access problems if there are any folders that I don't have access but administrator is the owner of the folders and some owned by users themselves.

your script would copy everything in the share which I do not want. it needs to copy specified users
LVL 30

Expert Comment

ID: 41789935
foreach  %i in (userlist) do robocopy \\servername\sharename\home\%i \\servername\sharename\home\migrated_users\%i /mir /copyall
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

LVL 30

Assisted Solution

serialband earned 1336 total points
ID: 41789938

Author Comment

ID: 41789981
Hi Serialband,

both scripts won't do what I am trying to achieve. it is looking for a source and destination locations to copy everything over.

with the Robocopy still not sure how it is importing userlist to search in a source location...

LVL 30

Accepted Solution

serialband earned 1336 total points
ID: 41790033
For the scripts, you need to replace the sourcepath and destination paths with those of your system.

In the foreach loop, you need to replace userlist with a comma separated list of files.

If you want to load the list from a separate text file, you'll need to do the following:

for /F "tokens=*" %i in (userlist.txt) do robocopy \\servername\sharename\home\%i \\servername\sharename\home\migrated_users\%i /mir /copyall
LVL 20

Assisted Solution

compdigit44 earned 664 total points
ID: 41793512
Here is a thought.

1) On the current home folder directory use icacls.exe to export the ACL's of all folder and file permissions

2) Run robocopy to copy all data to new directory structure

3) update the icacls text file export to include the new directory path and import

****** Test everything before doing it in production******

Author Comment

ID: 41803666
resolved this using third party tools.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

618 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