Joseph Moody
asked on
Set Owner recursively
I have been reading the Scripting Guy's post on setting file ownership for a specific user.
His code is:
This works great for a specific folder. I am trying to get it to work recursively so that all subfolders and files have the same specified owner.
How can this be done?
His code is:
$objUser = New-Object System.Security.Principal.NTAccount("fabrikam", "kenmyer")
$objFile = Get-Acl C:\Scripts\Test.txt
$objFile.SetOwner($objUser)
Set-Acl -aclobject $objFile -path C:\Scripts\Test.txt
This works great for a specific folder. I am trying to get it to work recursively so that all subfolders and files have the same specified owner.
How can this be done?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER