takeown problem

Page 1 of 2 12 LastLast

  1. Posts : 307
    Windows 10
       #1

    takeown problem


    Hi

    I have Windows 10 v1511 Enterprise 64 bit with two Microsoft account.

    From the Command Prompt (run as administrator), I tried to write

    Code:
    takeown /S localhost /U "<Microsoft_account_(E-Mail_Address)>" /P <User_password>" /F "<Directory_path>" /R /A /D Y
    but I get the "Access Denied" error. Why?

    Thanks

    Bye
      My Computer


  2. Posts : 320
    Windows 10 Pro 22H2 Build 19045.2788
       #2

    I don't know answer to your question, but the easiest (best) way to take ownership is to use Brink's registry hack which will add "Take Ownership" to the file/folder context menu.

    I have attached a copy with two others that are very useful.

    :-
      My Computer


  3. Posts : 307
    Windows 10
    Thread Starter
       #3

    If I write the net user command, the profile names of the Microsoft accounts are displayed.

    If, however, I write

    Code:
    takeown /S localhost /U "<Account_profile_name>" /P "<Password>" /F "<Directory_path>" /R /A /D Y
    Windows indicates that this user does not exist.

    Also, if I try to activate the hidden administrator

    Code:
    net user Administrator /Active:yes
    net user Administrator "<Password>"
    and then I try to write

    Code:
    takeown /S localhost /U Administrator /P "<Password>" /F "<Directory_path>" /R /A /D Y
    Windows always indicates that this user does not exist.

    So, how should I use the /U option of takeown?

    Thanks

    Bye
      My Computer


  4. Posts : 5,478
    2004
       #4

    The /U switch is only applicable to remote computers and so you are trying to change the ownership on a remote computer called localhost which almost certainly doesn't exist.

    Even if you specify the name of your local PC (not localhost) you'll get an error WARNING: User credentials cannot be used for local connections.

    It isn't clear what you are attempting here as you seem to be trying to change the owner to the built in Administrator user and also the Administrators group with the /A switch.

    Assuming you want to change the owner to built in administrator you have various options.
    Code:
    runas /user:Administrator "takeown /F "<file path> /R""
    or, if you prefer probably a better solution is
    Code:
    icacls "<folder path>" /setowner Administrator /t
      My Computer


  5. Posts : 307
    Windows 10
    Thread Starter
       #5

    lx07 said:
    The /U switch is only applicable to remote computers and so you are trying to change the ownership on a remote computer called localhost which almost certainly doesn't exist.

    Even if you specify the name of your local PC (not localhost) you'll get an error WARNING: User credentials cannot be used for local connections.

    It isn't clear what you are attempting here as you seem to be trying to change the owner to the built in Administrator user and also the Administrators group with the /A switch.

    Assuming you want to change the owner to built in administrator you have various options.
    Code:
    runas /user:Administrator "takeown /F "<file path> /R""
    or, if you prefer probably a better solution is
    Code:
    icacls "<folder path>" /setowner Administrator /t
    If, from the command prompt (run as administrator), I had to write

    Code:
    takeown /F "<Directory_path>" /R /A /D Y
    icacls "<Directory_path>\*" /setowner Administrators /t
    icacls "<Directory_path>\*" /grant:r Administrators:F /t
    del /s /q "<Directory_path>\*.*"
    pushd "<Directory_Path>" && ( rd /S /Q "<Directory_Path>\" 2>nul & popd )
    I could delete the entire content of the directory structure even if its owner does not have read rights? If not, how do I remove this content?

    Thanks

    Bye
    Last edited by balubeto; 19 Jan 2016 at 04:06.
      My Computer


  6. Posts : 307
    Windows 10
    Thread Starter
       #6

    I always get the "Access Denied" error when I run the commands icacls. Why?

    It is possible to delete all the DACLs of this subdirectory, its files and its subdirectories and then give them those of its home directory? If so, how do I do this?

    Thanks

    Bye
      My Computer


  7. Posts : 5,478
    2004
       #7

    You have been asking the same question here and on other sites for months. Authority is quite simple. To do something with an object you must have authority to do it. Either you do or you don't.

    To grant authority to some object you must either be the owner or have authority to do so.

    The simplest way therefore is to take ownership (with takeown) and then grant yourself authority with icacls.

    You do not need to change authority to someone else (either Administrator or the Administrators group)

    I do have to wonder though (when you could have just typed in /?) why you keep asking the same question.

    You are making it far more complex than it is. All you need to do is take ownership, change authority and do what you want.

    That is all.

    If you have a specific problem then post the error message (and what you are trying to do and why) and we will see if we can figure it out.
      My Computer


  8. Posts : 307
    Windows 10
    Thread Starter
       #8

    I think I found the best solution to remove a directory structure which also contains symbolic links and with ACLs managed by TrustedInstaller or Authenticated Users or System users:

    Code:
    takeown /F "<Directory_path>" /A /R /D Y /SKIPSL >nul 2>&1
    icacls "<Directory_path>" /reset
    icacls "<Directory_path>" /grant:r Administrators:(OI)(CI)F /inheritance:e /Q /C /T /L >nul 2>&1
    pushd "<Directory_path>" && ( rd /S /Q "<Directory_path>" 2>nul & popd )
    Many thanks to all

    Bye
    Last edited by balubeto; 27 Jan 2016 at 03:39.
      My Computer


  9. Posts : 5,478
    2004
       #9

    Glad you got it working

    Are you sure about that first command though?

    Perhaps you aren't using English but /D S means you are defaulting S. Should it not be Y or N?
      My Computer


  10. Posts : 307
    Windows 10
    Thread Starter
       #10

    lx07 said:
    Glad you got it working

    Are you sure about that first command though?

    Perhaps you aren't using English but /D S means you are defaulting S. Should it not be Y or N?
    Right. Now, I correct it.

    Thanks

    Bye
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:05.
Find Us




Windows 10 Forums