Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to include the unc path in get-childitem output?

$
0
0

Hello - 

I wrote a script (below is a portion of the script omitting some identity references I don't want to see), to retrieve the ACL which also goes out to active directory and retrieves the group members of the AD groups in the ACL.  I cant seem to figure out how to use get-childitem -recurse so that the output includes the full unc path of each sub-folder under test$.  

For example, if \\servername\test$ contains 30 subfolders and I run the first line below, the $Shares winds up containing just folder names and not the \\servername\subfoldername1, \\servename\subfolder2, and so on.  

$Shares = GCI "\\ServerName\Test$" -recurse -directory

$Result = @() 

foreach ($Share in $Shares)

    {    

     $ACLs = get-acl -path $Share | select -expand access | where-object {$_.IdentityReference - notlike "*S-1-5-21-*"} |  where-object {$_.IdentityReference -notlike "*NT AUTHORITY*"} | where-object {$_.IdentityReference -notlike "Everyone"} | select IdentityReference,FileSystemRights

}

   Any insight is appreciated.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles