diff --git a/DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1 b/DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1 index 47bc30c72..bc53df62d 100644 --- a/DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1 +++ b/DSCResources/MSFT_xADObjectPermissionEntry/MSFT_xADObjectPermissionEntry.psm1 @@ -73,7 +73,7 @@ function Get-TargetResource } # Get the current acl - $acl = Get-Acl -Path "Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/$Path" + $acl = Get-Acl -Path "AD:$Path" foreach ($access in $acl.Access) { @@ -187,7 +187,7 @@ function Set-TargetResource Import-Module -Name 'ActiveDirectory' -Verbose:$false # Get the current acl - $acl = Get-Acl -Path "Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/$Path" + $acl = Get-Acl -Path "AD:$Path" if ($Ensure -eq 'Present') { @@ -229,7 +229,7 @@ function Set-TargetResource } # Set the updated acl to the object - $acl | Set-Acl -Path "Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/$Path" + $acl | Set-Acl -Path "AD:$Path" } <# diff --git a/README.md b/README.md index 1e43c5271..fb09747f7 100644 --- a/README.md +++ b/README.md @@ -368,6 +368,7 @@ The xADForestProperties DSC resource will manage User Principal Name (UPN) suffi * Added xADReplicationSiteLink * New resource added to facilitate replication between AD sites +* Updated xADObjectPermissionEntry to use `AD:` which is more generic when using `Get-Acl` and `Set-Acl` than using `Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/` * Changes to xADComputer * Minor clean up of unit tests. * Changes to xADUser diff --git a/Tests/Unit/MSFT_xADObjectPermissionEntry.Tests.ps1 b/Tests/Unit/MSFT_xADObjectPermissionEntry.Tests.ps1 index 39bd58357..18cad4c69 100644 --- a/Tests/Unit/MSFT_xADObjectPermissionEntry.Tests.ps1 +++ b/Tests/Unit/MSFT_xADObjectPermissionEntry.Tests.ps1 @@ -49,7 +49,7 @@ try } $mockGetAclPresent = { $mock = [PSCustomObject] @{ - Path = 'Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/CN=PC01,CN=Computers,DC=contoso,DC=com' + Path = 'AD:CN=PC01,CN=Computers,DC=contoso,DC=com' Owner = 'BUILTIN\Administrators' Access = @( [PSCustomObject] @{ @@ -72,7 +72,7 @@ try } $mockGetAclAbsent = { $mock = [PSCustomObject] @{ - Path = 'Microsoft.ActiveDirectory.Management\ActiveDirectory:://RootDSE/CN=PC,CN=Computers,DC=lab,DC=local' + Path = 'AD:CN=PC,CN=Computers,DC=lab,DC=local' Owner = 'BUILTIN\Administrators' Access = @() }