Powershell Set-Acl fails

Check this out POWERSHELL - EDITING PERMISSIONS ON A FILE OR FOLDER

From the post comment:

You're obviously getting this error because you're trying to change the owner of the object. By default NTFS will only allow you to set the owner of an object to:

A: Yourself
B: Administrators-group

That's it.

However, if you're an administrator or backup operator you can set it to any user, BUT this privilige is disabled by default and must be enabled before you can do so. In case you're wondering - this is a concious security restriction.

There are no .NET or PowerShell specific ways of enabling this, but if we leave Microsoft-territory and visit the PowerShell Community Extensions project we find a way...

I havent used PSCX that much and it's not a Microsoft product so any questions on them should be directed to www.codeplex.com/PowerShellCX rather than here, but here goes:

Download and install PSCX from www.codeplex.com/PowerShellCX

Set up a wrapper class for TokenPriviliege using the following syntax:

$oTP = New-Object PSCX.Interop.TokenPriviliege

Now, grant it to the current process:

Set-Privilege $oTP

You should now be able to change the owner of the folder to any user you wish.