From 9f3e71b24b8be90087e5d251488c7485123a37bc Mon Sep 17 00:00:00 2001 From: Dor Breger Date: Fri, 30 Aug 2024 23:24:50 +0300 Subject: [PATCH] (fix) use Set-DbaAvailabilityGroup even when there is no diff to generate module output --- plugins/modules/availability_group.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/modules/availability_group.ps1 b/plugins/modules/availability_group.ps1 index 1b4cf9ef..088c4d45 100644 --- a/plugins/modules/availability_group.ps1 +++ b/plugins/modules/availability_group.ps1 @@ -213,10 +213,8 @@ try { $existingAGHT = @{} $existingAG.psobject.Properties | ForEach-Object { $existingAGHT[$_.Name] = $_.Value } $agDiff = Compare-Object -ReferenceObject $existingAGHT -DifferenceObject $setAgSplat -Property $compareProperty - if ($null -ne $agDiff) { - $output = $existingAG | Set-DbaAvailabilityGroup @setAgSplat - $module.Result.changed = $true - } + $output = $existingAG | Set-DbaAvailabilityGroup @setAgSplat + $module.Result.changed = $true } } elseif ($state -eq "absent") {