|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Create Folder and Amend ACL's
I am after a script / batch file. Where by it prompts you for the samaccountname, then a server/folder and create an account and amend the ACL of it.... Something like this.... 1. Prompt for user id - enter "USERID" 2. Prompt for server folder - enter "\\sn000001\userfolder\area 3. Folder gets created \\sn00001\userfolder\area\userid 4. Permissions are changed on \\sn00001\userfolder\area\userid to include "USERID" (Full control) & "Domain Admins" (full control) & "admin group1" (full control) & "admin group2"(modify) any ideas? also what would be even better if step 2 can include some kind of selection list. "select 1 for \\sn000001, select 2 for \\sn000002...." the following is the simplfied version of vbs script, you might need add more
error checking and handling statements to make it perfrect. the essential is the "cacls" commandline. it is build in windows dos command, to check the usage, just type in cacls /? in command prompt. 'createfolder.vbs 'enter info userID=inputbox("Enter user ID:") Serverpath=inputbox("Enter server path:") folderpath=Serverpath & "\" & userID ' create folder set fs=CreateObject("Scripting.FileSystemObject") if not FolderExists(folderpath) then set f=fs.CreateFolder(folderpath) end if set f=nothing set fs=nothing Set objShell = CreateObject("Wscript.Shell") objShell.Run("%COMSPEC% /c Echo Y| cacls " & folderpath & " /t /c /g " & chr(34) & "Domain Admini" & Chr(34) & ":F " & chr(34) & userID & chr(34) & ":F " & chr(34) & "Admin group1" & chr(34) & ":F " & chr(34) & "Admin group2" & chr(34) & ":c ", 2, True) WScript.Quit -- Show quoteGolden_au "Simon G" wrote: > Hello all, > > I am after a script / batch file. Where by it prompts you for the > samaccountname, then a server/folder and create an account and amend the ACL > of it.... > > Something like this.... > > 1. Prompt for user id - enter "USERID" > 2. Prompt for server folder - enter "\\sn000001\userfolder\area > 3. Folder gets created \\sn00001\userfolder\area\userid > 4. Permissions are changed on \\sn00001\userfolder\area\userid to include > "USERID" (Full control) & "Domain Admins" (full control) & "admin group1" > (full control) & "admin group2"(modify) > > any ideas? > > also what would be even better if step 2 can include some kind of selection > list. "select 1 for \\sn000001, select 2 for \\sn000002...." |
|||||||||||||||||||||||