0

I have a repetitive task on Server 2012 R2 I'd love to automate. I have a CSV list of around 40 folder names I want to create (The names in this CSV changes). I then want to have those folders shared with the same name as the folder that is created. I also want to set full permissions for 3 local users on all folders.

I tried dabbling a bit with PowerShell but couldn't seem to get it going I think mainly because I was trying to use WMI to create the shares.. In the end I resorted to running the following and settings up the shares manually.

Set-Location "C:\test\" 
Import-Csv c:\test\folders.csv | New-Item -type directory

Any help appreciated!

2
3

You want to look at Import-Module SMBShare and use the New-SMBShare cmdlet. You can do permissions with the Set-ACL cmdlet.

Combine them with your Import-CSV command on the pipeline and you shouldn't have any issues at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.