There's no way to reference the exception that caused a catch block at the moment. The exception should be assigned to $_/$PSItem if it's referenced in the catch block.
Also, looks like I accidently used Enumerable.Count instead of ReadOnlyCollection<>.Count here.
There's no way to reference the exception that caused a catch block at the moment. The exception should be assigned to
$_/$PSItemif it's referenced in the catch block.Also, looks like I accidently used
Enumerable.Countinstead ofReadOnlyCollection<>.Counthere.