I am trying to handle errors when scanning through folders. Let\'s say I have something like:
Get-ChildItem $somepath -Directory | ForEach-Object { if(err
If you can install a non-ancient PowerShell version (3.0 or newer), simply prepend the path with \\?\ to overcome the 260-character limit for full path:
\\?\
Get-ChildItem "\\?\$somepath" | ForEach { # ............ }