How to: Manually take ownership of files (elevated CMD)

There’s an easy way to change permissions via the Windows UI, but, for some reason, it wouldn’t let me change the owner of a number of files in bulk. I had to do it on a file by file basis, which is far from optimal. My assumption is that this was caused by the currently logged in user, who did not have administrator permissions.

What is the problem

Normally, you’d select the file(s) you want to change the owner of, right click and then go to the “Security” tab of the Properties window. Unfortunately, this is not possible when the entire tab is missing:

The “Security” tab is missing

What is the solution

We can easily take ownership or assign ownership to a different account via CMD.

  1. Open an elevated CMD (run as administrator)
  2. Navigate to the folder where the files are
  3. Use the takeown command if you want the administrator account to take ownership of the files or
  4. Use the icacls command to make a different account the owner of the files as follows:

icacls * /setowner “account name”

This will proceed to change the ownership of all the files in the folder:

Setting the owner of a number of files in bulk with the command icacls * /setowner “account name”

References

  1. Recursively change ownership to another user in windows
MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned M365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.