Reset Ownership on users home areas

Morning All

I have an issues. I have just moved a large amount of data form one network to another.

I now need to be able to change the owner tag back to the user in question. At the moment it all belongs to administrator and due to this disk quota isnt working as it should.

I remember a few years back, there was a VBS file which you needed to say where the path to the home areas are located, you then run the VBS file and it changes the ownership flag back to the user..

I cant find this script and was wondering if anyone on here knows where I can find it, or post it, or even if there is now a better way to fix this.

Many Thanks
Danny
IKWebAsked:
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.

Daniel HelgenbergerCommented:
Why is this tagged OSX? What is the underlying file system for the user's home folders? If it is a POSIX file system, you can use a simple bash script to change the user's folders back to their owner, provided the owner's logon name is the same as it's home folder's name:
for d in /home/*; do chown -R $d /home/$d; done

Open in new window


Of course, when copying over home folders you should do this again and use rsync -a or robocopy /mir to keep the ACLs.
0
IKWebAuthor Commented:
Hello, I have no idea why OSX is listed. I only selected Windows.

The OS is Windows 2008 R2.
0
South ModModeratorCommented:
IKWeb,

I changed the zones for this question from

--Microsoft Server

to
--Microsoft Server
--Shell Scripting


SouthMod
Community Support Moderator
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Berkson WeinTech FreelancerCommented:
Are the root folders named identically to the username?  If so, a vbs script would work.  If not, we need some way of figuring out which folder gets mapped to which user.    (you might get more responses if you raise this to 500 points)
0
IKWebAuthor Commented:
Hi Weinberk

Yes, the folders are the same names as the users AD account.
0
CoralonCommented:
You can do this pretty easily from a cmd.exe prompt with SubinACL.  The presumption is that the user directories are named the same as the users' actual name.  
pushd \\server\homedirectoryshare
for /d %%f in (*) do subinacl %%f /setowner=%userdomain%\%%f /subdirectories /file
popd

Open in new window


If they are *not* the same, then you could set up a text file formatted like this:
directoryname     owningaccountname

Then you would do the same thing as above, but with a modified syntax.
pushd \\server\homedirectoryshare
for /f "tokens=1,2" %%f in (filename.txt) do subinacl %%f /setowner=%userdomain%\%%g /subdirectories /file
popd

Open in new window


Coralon
0

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
Berkson WeinTech FreelancerCommented:
0
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
Microsoft Server OS

From novice to tech pro — start learning today.