Quantcast
Channel: File Services and Storage forum
Viewing all articles
Browse latest Browse all 10672

Finding folders where ACL Inheritance is off

$
0
0

I have a script that search for folders on my file server where ACL Inheritance is turned off:

Get-ChildItem 'd:\' -Recurse -ErrorAction SilentlyContinue |

? {$_.PSIsContainer} |
? { Get-Acl $_.FullName | % {$_.GetAccessRules($true, $true, 'System.Security.Principal.NTAccount') | ? {!$_.IsInherited} } }

If I want that script search all folders on file server I get the following error:

 
The script failed due to call depth overflow.

At line:3 char:2
+  $_.GetAccessRules($true, $true, 'System.Security.Principal.NTAccount') |+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException+ FullyQualifiedErrorId : CallDepthOverflow

The script failed due to call depth overflow.
At line:2 char:2
+  Get-Acl $_.FullName | % {+  ~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException+ FullyQualifiedErrorId : CallDepthOverflow

The script failed due to call depth overflow.
At line:1 char:1
+ Get-ChildItem '\\server\d$\' -Recurse -ErrorAction SilentlyContinue | ? {$_.PSIs ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException+ FullyQualifiedErrorId : CallDepthOverflow

How can I bypass this error and make script finnish searching?


Viewing all articles
Browse latest Browse all 10672

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>