added powershell v2 compatibility