title: How do I change the owner of a folder with Powershell when Get-Acl returns "Access Denied"?
body: <p>I have a question about Get-Acl in Powershell.  I keep getting the error message, "Access to the path is denied". I want to change the owner of the folder to myself and then give myself full permissions to the folder using Powershell. Here's the line of code giving me the error:</p>
  
  <pre><code>$acl = Get-Acl "C:\SomeFolder"
  </code></pre>
  
  <p>I am using Windows Explorer to set the permissions on "SomeFolder" before running the script.  They are as follows:</p>
  
  <ul>
  <li>no entries in the access control list </li>
  <li>owner is not myself </li>
  </ul>
  
  <p>I do not receive the error message if I make myself the owner using the Windows Explorer GUI before running the Powershell script. I don't understand why I am allowed to change the owner with Windows Explorer but not using Powershell? I have full admin rights on this machine.  Windows 7, Powershell 2.0, .NET 3.5. </p>
  
  <p>I'm assuming the only way to change the owner is to use Get-Acl, set owner on the ACL, then use Set-Acl to write it back to the folder.  If there is another way, please let me know? How can I change the owner of the folder using Powershell? </p>