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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting permissions on shared folders 1

Status
Not open for further replies.
Aug 9, 2002
9
GB
Hi,

I need to develop a script/app which will find all of the computers in active directory with a name which ends in PRT01 and go through these and share a folder on each of the servers with specific access permissions.

I need to give authenticated users read, domain admins full control and remove everyone.

Finding the computers and creating the share is easy enough but I'm stuck for ideas on how to actually set the permissions.

I'm creating the shares using the following code, (I've removed a few lines about a case statement. The code originally came from share.vbs by microsoft)

Set objInstance = objService.Get("Win32_Share")

intStatus = objInstance.Create(strSharePath, strShareName, _
intShareType, null, strShareComment, null, null)

If intStatus = 0 Then
strMessage = "Succeeded in creating share " & _
strShareName & "."
Else
strMessage = "Failed to create share " & strShareName & "."
strMessage = strMessage & vbCRLF & "Status = " & _
intStatus & "."
End If

Does anyone have any suggestions about setting the permissions either using WMI or in any other way?

Regards,

Gareth
 
Hi,

I had a simular problem. The way I got round it was to use CACLS and SUBINACL. I shelled to them with the appropriate commands and it worked a treat.

If you want the code then let me know and I'll send it to you.
 
Thanks,

Thats pointed me in the right direction and I've got it sorted now.

Cheers

Gareth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top