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

AD & dont Inherit Folder Permission

Status
Not open for further replies.

Ouch

Programmer
Jul 17, 2001
159
0
0
GB
i am trying to write a script to turn of the Inherit Permissions of the folder security.

i have a script that creates users in AD and sets their home folder to //server/users/%username%

but when they try to access it the folder hasnt been created.

so i added a script to create the folder and set the users to have permissions as owner. but i cant turn of the Inherit Permissions in the script so users cant access each others folder

Can anyone help?
 
Hi Ouch,

I have the same problem. Have you found a solution?

Best Regards
Wibbe
 
I use xcacls from the resource kit and that does it.
 
there is a adssecurity dll available as part of the adsi resource kit, you may want to look at it if you are scripting ntfs security on files and folders. its is the nuts. great for generating audit info on file and folder permissions during server migrations, if you are brave enough you can use the old audits to set permissions on the new servers etc.

Const ADS_RIGHT_GENERIC_READ = &H80000000
Const ADS_RIGHT_GENERIC_EXECUTE = &H20000000
Const ADS_ACETYPE_ACCESS_ALLOWED = 0

Set sec = CreateObject("ADsSecurity")

Set sd = sec.GetSecurityDescriptor("FILE://c:\public\specs")
Set dacl = sd.DiscretionaryAcl

'-- Show the ACEs in the DACL ----
For Each ace In dacl
wscript.echo ace.Trustee
wscript.echo ace.AccessMask
wscript.echo ace.AceType
Next

Set ace = CreateObject("AccessControlEntry")
ace.Trustee = "ARCADIABAY\jsmith"
ace.AccessMask = ADS_RIGHT_GENERIC_READ Or ADS_RIGHT_GENERIC_EXECUTE
ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED

dacl.AddAce ace
sd.DiscretionaryAcl = dacl
sec.SetSecurityDescriptor sd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top