Added checks and rescue methods for Powershell v2