Solved

How can i use Powershell to setup shared folders for users and amend permissions?

Posted on 2015-01-15
2
348 Views
Last Modified: 2015-01-21
Hi All,

I need to create quite a few shared folders for users on a perticualar server and need to set the permissions for each folder so that inheritance is disabled with only them (the user) with modify rights and full rights for admin,domain admin and system only. I was hoping to use powershell to import a csv/txt file containing all the usernames and create the folders and permissions. I would like the folders to be named as their usernames also. After frantic searching on google and various others I'm stuck on what i want to do and what script i could put together. As you can tell by my username, I am a n00b, so anyhelp would be very very much appreciated. It's just confused me. Also, i have a test environment so don't worry! :D

So, to sum up.. I would like to achive the below:

Powershell to import usernames and create folders in the below location..

..Folders Created in //Server1/Users/(username)

Folders have inhertiance disabled with permissions set for MOdify only for the user and full access for Admins,domain admins.

Thanks All!
0
Comment
Question by:N00b2015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Emmanuel Adebayo earned 500 total points
ID: 40551549
Hi,

Use New-Item and set-Acl powershell command.

New-Item -ItemType directory -Path "$Path\$User"|Out-Null
        #set acl to folder
        $FCList=$FullControlMember+$User
        $FCList|ForEach-Object {
        $ACL=New-Object System.Security.AccessControl.FileSystemAccessRule($_,"FullControl","ContainerInherit,ObjectInherit","None","Allow")
                                $HomeFolderACL.AddAccessRule($ACL)
                                }
        Set-Acl -Path "$Path\$User" $HomeFolderACL

Check the Complete at Microsoft Script center from the link below

https://gallery.technet.microsoft.com/scriptcenter/How-to-create-home-folder-d968f1d4
0
 

Author Closing Comment

by:N00b2015
ID: 40553341
Brilliant thank you for this :)
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question