1

I am using PowerShell 7 that way I can get pass the 260 Character Limit on the 2008 R2 Server we are using for shared folders/files.

Code

$root = the targeted starting directory

$folderlist = Get-ChildItem -Path $root -Directory -Recurse

$permissionslist = @()
ForEach ($folder in $folderlist) {
    $AllAcl = Get-ACL -Path $($folder.Fullname)

Running the below code and getting

Get-Acl: C:\scripts\script.ps1
Line |
  17 |      $AllAcl = Get-ACL $folder.Fullname
     |                ~~~~~~~~~~~~~~~~~~~~~~~~
     | Invalid name. (Parameter 'name')

Any ideas on where to look? I am able to get to the folder, I have permissions to access the folder with the account I am using.

Adjusted the code with a try catch and Start-Transcript this is what happened

$root = L:\Depts\AdminFinance\Campus Planning\PR-00 Small Projects folders with no numbers\Completed small projects

The Folders That are giving me problems are as follows, I checked permissions and owner. The own is S-1-15... however the folder above the problem folder is same owner of S-1-15... I do not believe that is the problem.

PS TerminatingError(Get-Acl): "Invalid name. (Parameter 'name')"

$root\Bldg 50 Fuel Cell Lab Complete\0900 - Accounting & Administration\0900.40 All Other Proposals & Invoices\0900.40.4 Fees - Advertising, Permit, Fire Marshal

$root\Bldg 50 Fuel Cell Lab Complete\1000 - Monthly Report, Lg Documents, Visuals, Etc\1050.00 Professional Services Selection Process\1050.20 Construction Mgmt Services

$root\Fine Arts Print Making Studio (PR004)\0900 - Accounting & Administration\900.40 All Other Proposals & Invoices\900.40.4 Advertising-Permits-Fire Marshal Fees

$root\TV Studio Relocation bldg 14D Complete\0200.00 - Architect, subconsultant\0200.10 Architect (Subconsult) - Contract & Insurance, Notice to Proceed\0200.10.1 Contract Changes (ASAs)

$root\TV Studio Relocation bldg 14D Complete\0900 - Accounting & Administration\0900.40 All Other Proposals & Invoices\0900.40.3 Other Communications - Voice, Data, Etc

$root\TV Studio Relocation bldg 14D Complete\0900 - Accounting & Administration\0900.40 All Other Proposals & Invoices\0900.40.4 Fees - Advertising, Permit, Fire Marshal

$root\TV Studio Relocation bldg 14D Complete\1000 - Monthly Reports, Lg Documents, Visuals, Etc\1000.40 Shop Drawings (Sample Submittals) & UNF Review Comments

I am output the following info to a CSV File

"Path_Length" - "271"

"Target" - "Local\Domain Admins"

"Permission Level" - "FullControl"

"Path" - "$root\Bldg 50 Fuel Cell Lab Complete\1000 - Monthly Report, Lg Documents, Visuals, Etc\1050.00 Professional Services Selection Process\1050.20 Construction Mgmt Services"
Soulless Rekkr
  • 115
  • 1
  • 3
  • 12
  • Unable to replicate, but I think this may be related to your long filenames as well. [This question / answer](https://stackoverflow.com/questions/2450604/how-do-i-get-the-security-details-for-a-long-path) is for `c#`, unfortunately not `powershell` but it looks like the same basic functionality utilized and workarounds confirmed successful. Does this help at all? – gravity Apr 08 '20 at 14:52
  • I tired that before, here is the orignal post about the 260 character problem I was having and a lot that I have tried [here](https://stackoverflow.com/questions/60994380/powershell-5-0-pathtoolongexception-error). I edited my original post to show that the output is correct. Just trying to figure out the error so I can fix a problem if there is one. – Soulless Rekkr Apr 08 '20 at 15:09
  • Does `$folder |Get-Acl` work? – Mathias R. Jessen May 21 '20 at 14:23

0 Answers0