Convert Shell Script To Powershell Try And Catch