Check and Change owner recursively with Powershell?

by jstearns421   Last Updated October 09, 2019 15:00 PM

I know that I have seen how to change the owner but I was wondering if there was a way to check it first and only set it if it needs changed?

The current command I have to change it is: dir -r c:\Users\goyuix\temp | set-acl -aclobject $acl1

I want to check it first to try and speed things up on a large folder.



Answers 1


The owner of the objet is in the ACL, so you can read it like that:

$owner=(get-acl c:\temp).Owner
Swisstone
Swisstone
October 09, 2019 14:51 PM

Related Questions



Set group permission on folder

Updated June 05, 2015 06:00 AM

Remove ACL from Windows Registry Key via Powershell

Updated September 27, 2017 14:00 PM