Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set share permissions

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
Im writing a script to batch create AD users from an Excel File. Ive got everything working except setting the user permissions for their home directory. Im creating their home directory/share like this:

Dim ShareName, newshare
If Not FS.FolderExists(ParentDir & "\" & objuser.sAMAccountName) Then
FS.CreateFolder(ParentDir & "\" & objuser.sAMAccountName)
End If
ShareName = objuser.sAMAccountName & "$"
'On Error Resume Next
Set NewShare = ShareServiceObj.Create("fileshare", ShareName)
If Not Err Then
NewShare.Path = ParentDir & "\" & objuser.sAMAccountName
NewShare.MaxUserCount = 1 'Sets the limit for the number of user connections
NewShare.SetInfo
End If

What I cant figure out how to do is to grant the user rights to their share. I found a few references but havnt found any that i could make work yet. The ones I have found seem to be incredibly long and complex just to set share permissions. Can anybody point me in the right direction?

thanks
 
Use XCACLS to set NTFS permissions and NET SHARE to grant rights to the share itself. You can control each using the WScript.SHELL object.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top