mikedazzle99
Technical User
Need assistance with a Powershell script for automatically creating X and Y folders
The folders to be created have the following path
\\pathA
\\pathB
Looking to create a powershell script that takes the username as an input parameter, and executes the following file system operations
Create the user-folder \\home\homeshare\<username>
The user should have write access within these folders
Came up with this thus far but i am looking to have the input just the manual entered in and have the folders paths created based of this with the need acls.
Any help with having the code generate the path based of the username instead of the manual one below
The folders to be created have the following path
\\pathA
\\pathB
Looking to create a powershell script that takes the username as an input parameter, and executes the following file system operations
Create the user-folder \\home\homeshare\<username>
The user should have write access within these folders
Came up with this thus far but i am looking to have the input just the manual entered in and have the folders paths created based of this with the need acls.
Code:
#variables
$user = read-host "input username"
$path = read-host "input path"
#create the directory
new-item -Path $directory -name $username -ItemType directory
$NTPrinciple=[system.security.principal.ntaccount]$username
$permission=New-Object system.security.accesscontrol.filesystemaccessrule($NTPrinciple,'FullControl','Allow',$true,$true)
$acl = Get-Acl $path
$acl.SetAccessRule($permission)
Set-Acl $directory $acl
Any help with having the code generate the path based of the username instead of the manual one below