protected override void BeginProcessing() { try { var userApi = new UserApi(Utilities.Configuration); var resp = userApi.Delete(this.UserId); WriteObject("User successfully removed "); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }