Closed riahc3 closed 7 years ago
There was a recurse parameter quite long ago. There was some trouble with that but I must confess, I do not remember the technical details.
Is that a workaround?
dir -Recurse | Set-NTFSOwner -Account SYSTEM
Ill give it a shot tomorrow at work.
Please implement it. If you need help, there is some code and discussion already here: https://learn-powershell.net/2014/06/24/changing-ownership-of-file-or-folder-using-powershell/
It doesnt work correctly for me as that doesnt pass the 260 path limit.
Thank you for reading and replying.
Nope, same error when reaching a 260 limit.
$Folder="D:\somefolder\anotherfolder"
dir $Folder -Recurse | Set-NTFSOwner -Account 'mysuernameindomain'
Can you just replace the command 'dir' with 'dir2', then it works without the path limitation.
dir2 -Recurse | Set-NTFSOwner -Account install
There are some other commands for working around the path limitation provided by this module. Try:
Get-Command -Module NTFSSecurity -Name *Item2
Im kind of surprised why Set-NTFSOwner does not have a Recurse parameter.