The simplest commands to take ownership and give full permissions to administrators:
takeown /f directory_name /r /d y icacls directory_name /grant:r administrators:F /t
The above is recursive, through all files and folders in the tree. If recursion is not desired, remove /r and /t.