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!

Modifying NTFS permissions on a folder 1

Status
Not open for further replies.

alepore

MIS
Jun 25, 2001
27
US
I am just learning VBScript and I am trying to modify NTFS permissions on a folder. Using c:\test as an example, how would I give domain\joeuser change access to that folder? I thank you in advance for all the help.
 
If you know how to do it in a console window with the
Code:
 cacls
command, you can try something like this:
Code:
Set Sh=WScript.CreateObject("WScript.Shell")
RC=Sh.Run("cacls YourOptions",1,True)

Hope This Help
PH.
 
I use the adsSecurity.dll that comes in the ADSI SDK for this kind of stuff. Here is a generic example from that kit.

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