Get-Acl should produce nonterminating errors when it fails to access a file or directory
Votes from Connect: 11
Original Date Submitted: 7/20/2013 11:16:28 AM
Description:
Contact Information
Handle: David Wyatt
Site Name: PowerShell
Feedback ID: 794618
Frequency: Always Happens
Regression: Yes, this happens in previous released versions
Problem Description:
Get-Acl currently throws terminating errors anytime it fails to access a file or directory, even though it accepts an array of strings for the Path / LiteralPath parameters, and accepts pipeline input. Per Microsoft's guidelines for cmdlet error reporting (http://msdn.microsoft.com/en-us/library/windows/desktop/ms714412(v=vs.85).aspx), it seems like these should be non-terminating errors, as they are related to a specific input object, and should not prevent processing of more input objects.
It is currently only possible to work around this issue by piping objects to ForEach-Object (instead of directly to Get-Acl), and in the foreach block, call Get-Acl once for each object.
Product Studio item created by Connect Synchronizer due to creation of feedback ID 794618 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=794618).
Repro Steps:
-Recurse only included to ensure the command keeps going until it hits an error.
Get-ChildItem -Path "c:" -Recurse |Get-Acl
To work around:
Get-ChildItem -Path "c:" | ForEach-Object { Get-Acl -Path $_.FullName }
Expected Results:
FileSecurity and DirectorySecurity objects should be output for all items that can be read, and non-terminating errors should be produced for objects that encounter errors.
Internal BugId: 4313
