From 4f0ec2eded54626463b4f8b1e916f446ba180878 Mon Sep 17 00:00:00 2001 From: Sven Boll Date: Fri, 20 Aug 2021 19:06:05 +0200 Subject: [PATCH 1/3] add also 'RestoreFromRecycleBin' to IgnoreProperties --- .../MSFT_ADOrganizationalUnit/MSFT_ADOrganizationalUnit.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/DSCResources/MSFT_ADOrganizationalUnit/MSFT_ADOrganizationalUnit.psm1 b/source/DSCResources/MSFT_ADOrganizationalUnit/MSFT_ADOrganizationalUnit.psm1 index f0d9c6d9c..3f53f2dfc 100644 --- a/source/DSCResources/MSFT_ADOrganizationalUnit/MSFT_ADOrganizationalUnit.psm1 +++ b/source/DSCResources/MSFT_ADOrganizationalUnit/MSFT_ADOrganizationalUnit.psm1 @@ -173,7 +173,7 @@ function Test-TargetResource { # Resource should exist $propertiesNotInDesiredState = ( - Compare-ResourcePropertyState -CurrentValue $targetResource -DesiredValues $PSBoundParameters -IgnoreProperties 'Credential' | + Compare-ResourcePropertyState -CurrentValue $targetResource -DesiredValues $PSBoundParameters -IgnoreProperties ('Credential', 'RestoreFromRecycleBin') | Where-Object -Property InDesiredState -eq $false) if ($propertiesNotInDesiredState) From 5b3ed362d72694d56cb87e0a67b8561e9148ae6c Mon Sep 17 00:00:00 2001 From: Sven Boll Date: Fri, 20 Aug 2021 19:18:05 +0200 Subject: [PATCH 2/3] update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e2ce6b2..e2cab4bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,7 @@ For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md) `Get-ADObject` when `Get-ADGroupMember` throws a specific error. ([issue #616](https://github.com/dsccommunity/ActiveDirectoryDsc/issues/616)). - ADOrganizationalUnit - - Removed Credential from the list of desired values to compare when passed + - Removed Credential and RestoreFromRecycleBin from the list of desired values to compare when passed ([issue #624](https://github.com/dsccommunity/ActiveDirectoryDsc/issues/624)). - ADReplicationSiteLink - Fixed setting options after the resource is initially created From 44c55911400f8e344e97790e2e93832f596b8615 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 1 May 2022 11:43:56 +0200 Subject: [PATCH 3/3] Add unit test --- tests/Unit/MSFT_ADOrganizationalUnit.Tests.ps1 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Unit/MSFT_ADOrganizationalUnit.Tests.ps1 b/tests/Unit/MSFT_ADOrganizationalUnit.Tests.ps1 index 96e32f46e..e2ba68da1 100644 --- a/tests/Unit/MSFT_ADOrganizationalUnit.Tests.ps1 +++ b/tests/Unit/MSFT_ADOrganizationalUnit.Tests.ps1 @@ -255,6 +255,21 @@ try Test-TargetResource @testTargetResourcePresentParams | Should -BeTrue } } + + # Regression test for issue https://github.com/dsccommunity/ActiveDirectoryDsc/issues/624. + Context 'When parameter RestoreFromRecycleBin is specified' { + It 'Should return $true' { + $mockTestTargetResourceParameters = @{ + Name = $mockResource.Name + Path = $mockResource.Path + Description = $mockResource.Description + ProtectedFromAccidentalDeletion = $mockResource.ProtectedFromAccidentalDeletion + RestoreFromRecycleBin = $true + } + + Test-TargetResource @mockTestTargetResourceParameters | Should -BeTrue + } + } } Context 'When the Resource should be Absent' {