Take ownership of folders in Win2008 via command line?

Discussion in 'Windows Server' started by Whiteford, May 4, 2010.

  1. Whiteford

    Whiteford Guest

    Hi,

    I need to take ownership of a huge folder on our Windows 2008 server. I
    have restored 1TB of data but the GUI tool keeps prompting for me to skip
    etc. Can I use a command line tool to five the system account full
    ownership of all files?

    Thanks
     
    Whiteford, May 4, 2010
    #1
    1. Advertisements

  2. Under Win7 I would use takeown.exe. If this command does not exist under
    Win2008 then you can probably copy it across from a Win7 PC.
     
    Pegasus [MVP], May 4, 2010
    #2
    1. Advertisements

  3. Whiteford

    Whiteford Guest

    Thanks it does have this tool!

    However when I use it I get the error "info: the current logged on user does
    not have ownership privileges on the file (or folder): ("f:\folderername")

    and

    INFO: Access is denied. ( "f:\foldername" )

    Shouldn't this tool take control?
     
    Whiteford, May 4, 2010
    #3
  4. Whiteford

    Whiteford Guest

    It seemed to work on this folder if I added the "system" account via the GUI
    first then run the takeown tool, how can I then add the "system" account to
    all folders and directories first via the command line then take ownership?
     
    Whiteford, May 4, 2010
    #4
  5. The trusty old cacls command will do it:

    cacls "d:\User Files" /e /t /c /g system:f

    On Windows 7, cacls still works but is deprecated. icacls.exe should be used
    instead.
     
    Pegasus [MVP], May 4, 2010
    #5
  6. Whiteford

    Whiteford Guest

    I still get access denied on folders if I use:

    cacls "d:\User Files" /e /t /c /g system:f

    Do I need to take ownership first?

    as it is Win2008 should I use icacls instead?
     
    Whiteford, May 4, 2010
    #6
  7. Yes, take ownership first. It is up to you whether you use cacls.exe or
    icacls.exe.
     
    Pegasus [MVP], May 4, 2010
    #7
    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.