managing NTFS permissions - cacls or wmi?

Discussion in 'Scripting' started by James, Nov 14, 2008.

  1. James

    James Guest

    cacls or wmi for managing ntfs permissions?

    I was going to go with cacls but having an issue using 'echo y | cacls...'
    command? my cacls command is good, it works until I try to echo y into it so
    it can go without user interaction. Anyone know whats up with that?

    how is wmi for this? haven't looked yet, just looking for others opinions
    based on their experiences using either of these

    James, Nov 14, 2008
    1. Advertisements

  2. James

    James Guest

    I was putting a space after y in: echo y | cacls...

    echo y| cacls... without the space works, of course :)

    regardless, still interested in hearing about others experience using this
    and/or wmi for scripting ntfs permission managment tasks. I have not looked
    into the wmi route but do recall an example somewhere that looked overly
    complicated for the goal at hand... I'm thinking cacls is much simpler, with
    the only negative being I need to shell out from wsh.

    James, Nov 14, 2008
    1. Advertisements

  3. James

    Marcin Guest

    James - stick to cacls (try xcacls or icacls if you are running Vista).
    While managing permissions via scripting (with or without WMI) is certainly
    possible, such approach is considerably more complex and time consuming.
    Check to get a
    taste of it...

    Marcin, Nov 16, 2008
  4. I frequently use cacls from both command line and script. I use it
    exclusively with the /E switch, which does not present a confirmation
    prompt. In my case, I am just wanting to grant (or revoke) a specific user
    from the directory or file. I am not concerned with altering other
    permissions on the directory.

    I also looked at the WMI method sometime back & came to the same
    conclusion as you. It is indeed a lot of learning and work to accomplish
    what shelling out to cacls could accomplish easily.
    James Whitlow, Nov 16, 2008
  5. Just so you know: cacls also takes a /f (“force”) parameter to skip
    David Trimboli, Nov 17, 2008
  6. James

    James Guest

    thanks all for the great input. I appreciate it.

    James, Nov 17, 2008
  7. James

    David Guest

    we use the following in a bacth file during our initial image building to
    set it up.

    xcacls.vbs c:\temp /t /e /g BUILTIN\USERS:F /E /I ENABLE
    xcacls.vbs c:\temp /t /e /g "domain\DOMAIN USERS":F /E /I ENABLE
    David, Nov 19, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.