Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Creating an array of directories

$
0
0

Dave,
While it steps through the directories properly -going to a list of three sublayers, the Get-ACL portion only returned what was a very small portion of the acl. I have taken your ideas and the below may yield all the results although I need to identify the directory each entry pertains to.

function Get-SubDirectories
{
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$RootFolder,

[uint32]
$Depth = 3
)

$path = $RootFolder
$total=@()
for ($i = 1; $i -le $Depth; $i++)
{
$path = Join-Path -Path $path -ChildPath ‘*’
$dir=Get-ChildItem -Path $path -Directory
$total+=$dir
}
Write-Output $total
}

$acl=Get-SubDirectories -RootFolder “\\NAS\Share\Agency Group Folder” -Depth 3 | Get-ACL |select -expand access

Write-Output $acl

Each output item looks like,
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None

This is what I am looking for for each directory (three layers deep). I will toy around with trying to get the directory listed with each entry. If you know readily, please advise. Thanks.


Viewing all articles
Browse latest Browse all 13067

Trending Articles