Welcome to Scripting Forums Sign in | Join | Help
in Search

ACE Permissions not propogating

Last post 03-15-2007, 4:09 PM by AbqBill. 2 replies.
Sort Posts: Previous Next
  •  03-15-2007, 4:09 PM 524

    ACE Permissions not propogating

    The below snipped is working as intended except that the permissions are not being propogated down to the existing files and folders.  Can anyone tell me what am I doing wrong?

    Sub SetPermissions(strFolder, strTrustee)
      Set objSecurity = CreateObject("ADsSecurityUtility")
      Set objSD = objSecurity.GetSecurityDescriptor(strFolder, _
                        ADS_PATH_FILE, ADS_SD_FORMAT_IID)
      Set objDACL = objSD.DiscretionaryAcl
      Set objNewAce = CreateObject("AccessControlEntry")

      'set file access to directory so Everyone can
      'read existing files in the directory.
      Set objNewAce = CreateObject("AccessControlEntry")
      objNewAce.Trustee = strTrustee
      objNewAce.AccessMask = FILE_FULL_ACCESS
      objNewAce.AceType = ACETYPE_ACCESS_ALLOWED

      'permissions are to be propogated to existing files/folders & inherited by any new files/folders
      objNewAce.AceFlags = CONTAINER_INHERIT_ACE Or OBJECT_INHERIT_ACE
      objDACL.AddAce objNewAce

      'set directory permissions so Everyone can add files
      Set objNewAce2 = CreateObject("AccessControlEntry")
      objNewAce2.Trustee = strTrustee
      objNewAce2.AccessMask = FILE_FULL_ACCESS
      objNewAce2.AceType = ACETYPE_ACCESS_ALLOWED
      objNewAce2.AceFlags = CONTAINER_INHERIT_ACE
      objDACL.AddAce objNewAce2
      objSD.DiscretionaryAcl = objDACL

      objSecurity.SetSecurityDescriptor strFolder, _
                  ADS_PATH_FILE, objSD, ADS_SD_FORMAT_IID
    End Sub

     

  •  04-10-2007, 9:55 AM 631 in reply to 524

    Re: ACE Permissions not propogating

    I still can't get it working but I know why I am having the problem.  The permissions I am trying to change are under Documents and  Settings.  This folder has special  security set on it.  It looks like I need to figure out how to change the SE_DACL_Protected flag.

    Any help will be greatly appriciated!

    jj

  •  04-13-2007, 10:51 AM 658 in reply to 631

    Re: ACE Permissions not propogating

    Hi jcampbel,

    Changing permissions using ActiveX objects in a script, like you're trying to do, is notoriously difficult.

    I recommend SetACL (http://setacl.sourceforge.net/) instead. The syntax is complex (but probably less complex than what you're trying to do), and I've found it to be very useful and reliable.

    HTH,

    Bill

View as RSS news feed in XML
SPONSORED LINKS FEATURED LINKS

Free Download –VS 2008 TrainingExperts Ken Getz & Robert Green plus labs, code, courseware Maximize speed, performance and reliablity of your PCs and servers—automatically!Speed Up Your PC! Try Diskeeper 2008 with InvisiTasking Free Now! Register for SolarWinds VM MonitorGet X-Ray Vision into Your ESX Servers with SolarWinds FREE VM Monitor GoGrid Offers FREE Trial for Windows Cloud ServersDeploy Windows Server 2003 and 2008 with free load balancing through GoGrid’s award winning web-based GUI – all in less than 5 minutes Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD. How healthy is your Exchange Server? Find out Now!Automatic Exchange Server Maintenance helps prevent disasters and improves performance. Download a FREE Exchange Server analysis tool. You've Deployed SharePoint...Now What?This one-day free online conference delivers the technical knowledge needed to kick MOSS up a notch. In one information-packed day, independent SharePoint experts will present practical, real-world information and provide take-away, ready-to-use solutions Ease Your Scripting Pains with the Flexibility of PowerShell!Paul Robichaux equips you with PowerShell basics in 3 introductory lessons, each followed by live Q&A—all on your own computer! Register today! What Would You Do If You Ran Microsoft?ITTV's 2008 inaugural video contest, "If I Ran Microsoft..." is your chance to tell it like it is. Be goofy or be serious, but don"t miss this chance to have fun, win prizes, and go viral in a major way. Maximize Your SharePoint InvestmentThis web seminar discusses how true bi-directional replication of SharePoint content from one server to another enables branch offices to maintain access to current SharePoint content. Rock Your Knowledge, and Compete with Friends and Colleagues!Are you the Web Application Performance Guru in your office? It's time to have fun! Download now to access the crossword puzzle. Challenge yourself and complete this fun activity!

 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing