change ownership using Icacls on windows

12,769

I got the same problem on Windows 2008 R2, I was trying to set ownership to Administrators, so after getting the same error, I check the users on the domain, and found out that Administrators is NOT a username or group for the domain, but for the PC/SERVER, so, what I did is instead of

ICACLS name /setowner <computername>\adminuser

simply did

ICACLS name /setowner adminuser

and it worked.

Share:
12,769

Related videos on Youtube

user1874594
Author by

user1874594

Updated on September 18, 2022

Comments

  • user1874594
    user1874594 over 1 year

    On a windows 7 enterprise 64 bit OS - I want to change ownership of a folder inherited to all sub-folders using ICACLS

    I am logged in as standard user. The folder is owned by an administrator user, and I run the icaclsas that elevated user's command prompt I am not all very privy with windows but I want to do this as standard user running an elevated cmd
    so this is what I tried and did not work

    ICACLS name /setowner <computername>\adminuser
    

    Before that I used icacls to grant F to adminuser and it succeeded.
    What did not succeed is changing owner from the command prompt using icacls and the command prompt is from a user who owns the folder. So the folder owner is running icacls and making another user the owner. I get this error
    setowner No mapping between account names and security IDs was done. Successfully processed 0 files; Failed processing 0 files