powershell script to switch ownership of the files.

Could you please recommend powershell script to switch ownership of the files.
For example from user@Source.com to the user@TARGET.com

Our users were re-created from scratch in the target forest, so we need to have a script to change ownerships of files from source users to target users.
We have a different naming convention in the target for users, so the script would need to read the input excel file where I have listed the directories and new owners for the files.

Is it possible? Please help. Thank you very much!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

subinacl is a Windows sysadmin's power tool for doing everything to do with ownership and ACLs. You can change the ownership to anyone other than just you (you can't do this with the GUI).

subinacl /file test.txt /setowner=domain\foo

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
creative555Author Commented:
Thank you so much! I checked subinacl and it is a great tool indeed but not very user friendly.
What would be a command use input excel file with current owners and directories that I need to change ownerships for?
creative555Author Commented:
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

creative555Author Commented:
I will just run it line by line and copy from excel. this will work. Thank you
creative555Author Commented:
Solution is just to do a batch file and run line by line like this. It is easier just to copy and paste from excel all the shares and save it as the batch file.

subinacl /file test.txt /setowner=domain\foo
subinacl /file test.txt /setowner=domain\foo
subinacl /file test.txt /setowner=domain\foo
creative555Author Commented:
This was a resolution. I just didn't realize i can run many lines in the batch file. :) THank you
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.