script to copy an drestore user profile data

Hello all,

I am trying to create a script to backup user data. I have a powershell script which works great. But here is the problem, the user name are getting changed as we are moving to new domain. So if I run the script I got it on Internet, it works fine. It back up data to server with username. How I ccan I restore that to new user name. Is there any possibility that a script looks through an excel sheet and match the username and restore the data.

A SAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
If you had a CSV file with two columns, newusername and oldusername, it seems like it would be fairly easy to load that in to a hash table and then cross reference the new user to the old user name, and use that old name in the restore part of the script when it looks for the backed up files.  Have you tried something like that in powershell?

Another more brute force approach is just to rename the backup folders to the new user name.  If you have a lot of those to do that could be easily done in a small BAT or PS1 script that reads the same kind of CSV mentioned above to get the cross reference.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
A SAuthor Commented:
I haven't tried that Bill, thanks for pointing me to that direction. So what changes I have to make to attached script to check for new names?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.