From 17e58129a9ae9e70e78d37841572f9b8ee3d0acb Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 12 Feb 2023 15:01:42 +0100 Subject: [PATCH] Fix commands --- source/Public/Disable-SqlDscAudit.ps1 | 3 ++- source/Public/Enable-SqlDscAudit.ps1 | 3 ++- source/Public/New-SqlDscAudit.ps1 | 3 ++- source/Public/Set-SqlDscAudit.ps1 | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/Public/Disable-SqlDscAudit.ps1 b/source/Public/Disable-SqlDscAudit.ps1 index dca7e3bfa5..79ec71c380 100644 --- a/source/Public/Disable-SqlDscAudit.ps1 +++ b/source/Public/Disable-SqlDscAudit.ps1 @@ -85,7 +85,8 @@ function Disable-SqlDscAudit } # If this command does not find the audit it will throw an exception. - $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters + $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters | + Select-Object -First 1 } $verboseDescriptionMessage = $script:localizedData.Audit_Disable_ShouldProcessVerboseDescription -f $AuditObject.Name, $AuditObject.Parent.InstanceName diff --git a/source/Public/Enable-SqlDscAudit.ps1 b/source/Public/Enable-SqlDscAudit.ps1 index f492d912cb..5a403c89d0 100644 --- a/source/Public/Enable-SqlDscAudit.ps1 +++ b/source/Public/Enable-SqlDscAudit.ps1 @@ -85,7 +85,8 @@ function Enable-SqlDscAudit } # If this command does not find the audit it will throw an exception. - $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters + $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters | + Select-Object -First 1 } $verboseDescriptionMessage = $script:localizedData.Audit_Enable_ShouldProcessVerboseDescription -f $AuditObject.Name, $AuditObject.Parent.InstanceName diff --git a/source/Public/New-SqlDscAudit.ps1 b/source/Public/New-SqlDscAudit.ps1 index 99bad6a49b..856bbcef42 100644 --- a/source/Public/New-SqlDscAudit.ps1 +++ b/source/Public/New-SqlDscAudit.ps1 @@ -214,7 +214,8 @@ function New-SqlDscAudit ErrorAction = 'SilentlyContinue' } - $auditObject = Get-SqlDscAudit @getSqlDscAuditParameters + $auditObject = Get-SqlDscAudit @getSqlDscAuditParameters | + Select-Object -First 1 if ($auditObject) { diff --git a/source/Public/Set-SqlDscAudit.ps1 b/source/Public/Set-SqlDscAudit.ps1 index e783cf9207..2f60d8c358 100644 --- a/source/Public/Set-SqlDscAudit.ps1 +++ b/source/Public/Set-SqlDscAudit.ps1 @@ -259,7 +259,8 @@ function Set-SqlDscAudit ErrorAction = 'Stop' } - $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters + $AuditObject = Get-SqlDscAudit @getSqlDscAuditParameters | + Select-Object -First 1 } if ($Refresh.IsPresent)