From 286cedbb99521794b7d5405a8a29c20e7fdf2b91 Mon Sep 17 00:00:00 2001 From: FriedrichWeinmann Date: Tue, 3 Oct 2023 19:09:56 +0200 Subject: [PATCH] Fixing error message mapping --- public/Get-DbaCmObject.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/Get-DbaCmObject.ps1 b/public/Get-DbaCmObject.ps1 index dd7ae9e6ca..297c86470b 100644 --- a/public/Get-DbaCmObject.ps1 +++ b/public/Get-DbaCmObject.ps1 @@ -171,7 +171,7 @@ function Get-DbaCmObject { $badConnection = $false $badCredentials = $false - $code = $ErrorRecord.Exception.InnerException.StatusCode + $code = $ErrorRecord.Exception.InnerException.StatusCode -as [int] $message = $messages[$code] #region 1 = Generic runtime error @@ -220,6 +220,7 @@ function Get-DbaCmObject { Message = $message BadConnection = $badConnection BadCredentials = $badCredentials + Error = $ErrorRecord } } #endregion Utility Functions