Ownership of a file or directory may be changed using the SetOwner method of the ACL object. Changing the ownership of a file requires administrative privileges.
The owner of the C:TempACL1 file is the current user:
PS> Get-Acl C:TempACL1 | Select-Object Owner
Owner
-----
COMPUTERChris
The owner may be changed (in this case, to the Administrator account) using the SetOwner method:
$acl = Get-Acl C:TempACL1
$acl.SetOwner(
[System.Security.Principal.NTAccount]'Administrator'
)
Set-Acl C:TempACL1 -AclObject $acl
This is not taking ownership:
Setting ownership when the current user already has full control is one thing. Very specific privileges are required to take ownership without existing permission:
SeRestorePrivilege, SeBackupPrivilege, and SeTakeOwnershipPrivilege.
Setting ownership when the current user already has full control is one thing. Very specific privileges are required to take ownership without existing permission:
SeRestorePrivilege, SeBackupPrivilege, and SeTakeOwnershipPrivilege.