Created
May 18, 2022 15:33
-
-
Save dezfowler/bea848d04631be14c90943aa4428a6c0 to your computer and use it in GitHub Desktop.
Fix incorrect file or folder owner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$from = $(throw "-from is required."), | |
[string]$to = $(throw "-to is required.") | |
) | |
$correctOwner = (Get-Acl $from).GetOwner([System.Security.Principal.SecurityIdentifier]) | |
$acl = Get-Acl $to | |
$acl.SetOwner($correctOwner) | |
Set-Acl $to $acl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment