New Script for Home Folder

I’ve inherited a server and the user permissions for user home direcotries is all over the place! I’m new to Powershell and looking for a script to tidy up owners and permissions of users Home directories. All Home drives are in a folder

Username matches the name on the Home Directory.

I need to set the owner for each folder (and its contents) as the AD Username and also set permissions as follows:-

Domain Admins - Full Control
Administrators - Full Control
System - Full Control
Domain\Username - Modify
Creator Owner - Modify
Domain\SupervisorGroup - Modify

Can anyone help me with a script I can run on the server to make these changes please

Welcome to the forums Stu. I’m sure we can help you with a script, but you need to actually post one. This is not a script writing service. What have you tried? Have you done any research? PowerShell is a discoverable language that is very well documented. There are a couple of commands you should look at that may help you get started. To view the documentation for the commands use Get-Help. I usually add the -online or -showwindow switch to the command to get the full docs online or in a separate window.

Get-Help Get-Acl -online
Get-Help Set-Acl -online

Specifically look at the examples in Set-Acl. Get-Help works every time. Just ask the god of thunder Thor: Ragnarok - "Get Help" Clip - YouTube

1 Like

Another tip is to search for it. Home drive permissions is an age old issue. A search for “powershell home drive permissions” found 292,000,000 results for me.