AD script needed to inherent permissions from parent object tofix home drive and shared drive issues

I'm looking to get some assistance with a script needed to resolve the following issue:

Issue: - Customer has an Enterprise NAS solution with EMC. They were doing Scheduled Maintenance on it and they (EMC) were to delete a file system (one of the replicated areas at the other sites) and deleted the wrong file system inadvertently. They deleted the production file system at their Estherville, IA location. The Customer lost access to home drives and shared drives that go out to everyone. Users are getting permissions error “Access is denied”. The H drive is mapped in AD to: \\EV-NAS\Stf-Home\ (Staff Employees) and \\EV-NAS\ACD-Home\ (Students). The basic fix is to go in and take ownership of the object so that they inherent permissions from the parent object.

The manual fix for the issue is as follows:

•      On the Estherville DC access the \\EV-NAS\Stf-home share (users are listed inside of this directory)
•      Right click on the user folder and select Properties, on the Security Tab choose Advanced. Owner, Edit and check the box ‘Replace Owner on subcontainers and objects’
•      Go back into Properties, on the Security Tab choose Advanced, Ensure the box ‘Include inheritable permissions for this object’s parent’ is selected

Does anyone have a script that could automate this process?

Thanks in advance!
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.

Dale HarrisProfessional Services EngineerCommented:
Here's what you might need to get you started:

Obviously the script I wrote didn't work for him because he wasn't the owner.  But using that as your base, you might be able to find something that works for your environment.

Good luck.


Dale HarrisProfessional Services EngineerCommented:
Another question answered by me that applies to home folders and setting unique permissions based on username.

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
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
VB Script

From novice to tech pro — start learning today.