Hi,
I could use some help.
I have a script right now that works to grant ownership to the username of a directory in Profiles directory.
That part works fine, but I need to: Replace owner on subcontainers and objects
Could someone please assist? Thank you in advance.
$Users = Get-ChildItem -Path \\ServerName\Profiles\
Foreach ($User in $Users)
{
$ACL = Get-ACL $User.PSPath
$UserName = New-Object System.Security.Principal.NTAccount("DomainName", $User.name)
$ACL.SetOwner($UserName)
set-acl -Path $User.PSPath -aclObject $acl
}