Looking for a way to continue on exception - script exits when "Access Denied" to a folder exception takes place
Using Alphaleonis library to get long paths (above 260 character limit). This script runs until it encounters "Access Denied" on the folder. Can someone help me get this script to actually continue to the next folder instead of exiting.
[Reflection.Assembly]::LoadFile("C:\AlphaFS\AlphaFS.dll")
$Path = "D:\"
$Folders = [Alphaleonis.Win32.Filesystem.Directory]::GetDirectories($Path,"*","AllDirectories")
Foreach ($Folder in $Folders) { $Folder }