Setting permissions on home folders

Discussion in 'Scripting' started by HAL07, Jul 16, 2009.

  1. HAL07

    HAL07 Guest

    I have recently issued disk quotas on my home folders:

    at server:
    dirquota autoquota add /path:D:\Users /sourcetemplate:"max 6gb"

    then to ensure that all files in subdirs actually belongs to users and not administrators (which might have changed ownership
    during years), I want to replace ownership on all sub-folders using the following script:
    (run from server):

    for /f %%i in ('dir /b /a:d') do (
    rem rd /s /q "%%i"
    cscript xcacls.vbs %%i /o mydomain \%%i /T
    )

    however xcacls.vbs and any other script I've tested seem to return the following error on the users top-level folder:
    Error: This security ID may not be assigned as the owner of this object. (Msg#543)

    If I do this manually (right click users folder and click properties, Security tab, Advanced, Owner, and set the owner to the
    correct user, and check Replace owner on subcontainers and objects), it works fine! However I need a command that do this.
     
    HAL07, Jul 16, 2009
    #1
    1. Advertisements

  2. HAL07

    HAL07 Guest

    @echo off
    for /f %%i in ('dir /b /a:d') do (
    subinacl.exe /subdirectories "%%i" /setowner="mydomain\%%i"
    )


    did the trick. thanks for listening :)
     
    HAL07, Jul 16, 2009
    #2
    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.