diff --git a/CHANGELOG.md b/CHANGELOG.md index 70b32d0b..4f420341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The class-based resources are now re-using the module DscResource.Base - Fixes [Issue #404](https://github.com/dsccommunity/ComputerManagementDsc/issues/404). - Removed the file `source/build.psd1` as it is no longer required for the build pipeline. + - Fixed Delete-ADSIObject so that existing AD Computer objects will be deleted. Fixes [Issue #414](https://github.com/dsccommunity/ComputerManagementDsc/issues/414). - PSResourceRepository - The resource now supports the read-only property `Reasons` that the compliance part (audit via Azure Policy) of Azure AutoManage Machine diff --git a/source/DSCResources/DSC_Computer/DSC_Computer.psm1 b/source/DSCResources/DSC_Computer/DSC_Computer.psm1 index 141a91e6..834099a2 100644 --- a/source/DSCResources/DSC_Computer/DSC_Computer.psm1 +++ b/source/DSCResources/DSC_Computer/DSC_Computer.psm1 @@ -773,8 +773,8 @@ function Delete-ADSIObject $params = @{ TypeName = 'System.DirectoryServices.DirectoryEntry' ArgumentList = @( - $DomainName, - $Credential.UserName + $Path, + $Credential.UserName, $Credential.GetNetworkCredential().password ) ErrorAction = 'Stop'