I have been reading the Scripting Guy's post on setting file ownership for a specific user.
His code is:
$objUser = New-Object System.Security.Principal.NTAccount("fabrikam", "kenmyer")
$objFile = Get-Acl C:\Scripts\Test.txt
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?