Hi All,

I’m relatively new to scripting and I’ve seen many scripts where ownership can be given, but in my instance is a little unique.

Shared Drive is X:\home\users\userhome

…\users\userhome2

…\users\userhome3

and so on. I have over 100 users I need to complete this on a new 2012 R2 file server.

The userhome folder and the username is the same. I need the user’s domain account to have ownership of their individual home drive folder, sub-folders and files…

In addition to that, I would need the user to also have full NTFS access to that folder, sub-folders, and files.

I have a user list in a text file.

Any assistance is appreciated.

Archie

5 Spice ups

I played around with it:

but i found icacls to be easier for the time being.

2 Spice ups

I have used powershell for a lot of things and love using it. The more I learn the more I am blown away by how much it can do. If you have trouble with the script PM me and let me know. I will see if I can help you out. I love a good powershell challenge.

1 Spice up

Thanks JimAtDesk!

I’ll forward you what I have later today. I definitely see where powershell has a big edge on CLI batch scripting. I just wish I wasn’t as pressed as I am to get the script completed so I can learn and trial and error or complete. :slight_smile:

Thanks again and PM you later,

Arch

Sorry for not getting back to you all earlier. I’ve figured out what I need and here is what I did:

FOR /F “tokens=1” %%G IN (LOGONID.TXT) DO icacls Z:\HomeDrive\Client_subgroup%%G /grant ENTER.DOMAIN.HERE%%G:(OI)(CI)F /T | icacls Z:\HomeDrive\Client_subgroup%%G /SETOWNER ENTER.DOMAIN.HERE%%G /t >>Verify_LOG.txt

I’ve tested this in my test virtual environment and it works perfectly (as long as the client has a folder).

Now… if you have a powershell that can do the equivalent of that, I’d love to see it!

Thanks for your patience. :slight_smile:

Arch