This project is read-only.
1
Vote

Doesn't work on Powershell 3.0

description

Hi,
when I try to run it on Powershell 3.0 i get this error:
At C:\Users\admin_rojek\Desktop\roboPowerCopy.ps1:3406 char:6
+                     return $false
+                     ~~~~~~~~~~~~~
Control cannot leave a finally block.
At C:\Users\admin_rojek\Desktop\roboPowerCopy.ps1:3703 char:8
+                             return $false
+                             ~~~~~~~~~~~~~
Control cannot leave a finally block.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ControlLeavingFinally
Any way to fix this?

comments

ssuther wrote Apr 2, 2014 at 1:14 PM

Create and set a variable above the 'try/catch/finally' and set it to true
Replace the return statement to set the variable above to false
Below and outside of the finally, return the value of the variable.

That works for me.

ALIENQuake wrote Apr 2, 2014 at 4:47 PM

There are over 44 "try" statement :/ Could you be a more specific?