Skip to content

Commit 285a2e6

Browse files
Merge pull request #14 from PSSecTools/development
Added support for deleted objects
2 parents 8602fd9 + 84dffe3 commit 285a2e6

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

ADSec/ADSec.psd1

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RootModule = 'ADSec.psm1'
44

55
# Version number of this module.
6-
ModuleVersion = '1.0.1'
6+
ModuleVersion = '1.0.4'
77

88
# ID used to uniquely identify this module
99
GUID = '1cfaca0a-3c7d-47dd-bb9f-9711310a0b9d'
@@ -26,7 +26,7 @@
2626
# Modules that must be imported into the global environment prior to importing
2727
# this module
2828
RequiredModules = @(
29-
@{ ModuleName='PSFramework'; ModuleVersion='1.0.35' }
29+
@{ ModuleName='PSFramework'; ModuleVersion='1.12.346' }
3030
)
3131

3232
# Assemblies that must be loaded prior to importing this module

ADSec/changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.0.4 (2025-01-22)
4+
5+
- Upd: Raised PSFramework Dependency Version to 1.12.346
6+
- Upd: Get-AdsAcl - Enabled retrieving ACL from deleted objects
7+
- Upd: Get-AdsAcl - Detect insufficient access rights to retrieve security information
8+
39
## 1.0.1 (2022-04-04)
410

511
- New: Configuration setting to disable connection verification

ADSec/en-us/strings.psd1

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'Enable-AdsInheritance.Processing' = 'Starting process to enable inheritance on {0}' # $pathItem
1414
'Enable-AdsInheritance.ReadAcl.Failed' = 'Failed to access acl on {0}' # $pathItem
1515
'Enable-AdsInheritance.Updating.Acl' = 'Enabling inheritance' #
16+
'Get-AdsAcl.NoSecurityProperty' = 'No security information found on {0}. Ensure you have sufficient access.' # $pathItem
1617
'Get-AdsAcl.ObjectError' = 'Error accessing item: {0}' # $pathItem
1718
'Get-AdsAcl.Processing' = 'Retrieving Acl from {0}' # $pathItem
1819
'Get-AdsOrphanAce.Read.Failed' = 'Failed to access {0}' # $pathItem

ADSec/functions/acl/Get-AdsAcl.ps1

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
function Get-AdsAcl
2-
{
3-
<#
1+
function Get-AdsAcl {
2+
<#
43
.SYNOPSIS
54
Reads the ACL from an AD object.
65
@@ -44,23 +43,24 @@
4443
$EnableException
4544
)
4645

47-
begin
48-
{
46+
begin {
4947
$adParameters = $PSBoundParameters | ConvertTo-PSFHashtable -Include Server, Credential
5048
Assert-ADConnection @adParameters -Cmdlet $PSCmdlet
5149
}
52-
process
53-
{
50+
process {
5451
if (Test-PSFFunctionInterrupt) { return }
5552

56-
foreach ($pathItem in $Path)
57-
{
53+
foreach ($pathItem in $Path) {
5854
if (-not $pathItem) { continue }
5955
Write-PSFMessage -String 'Get-AdsAcl.Processing' -StringValues $pathItem
6056

61-
try { $adObject = Get-ADObject @adParameters -Identity $pathItem -Properties ntSecurityDescriptor }
57+
try { $adObject = Get-ADObject @adParameters -Identity $pathItem -Properties ntSecurityDescriptor -IncludeDeletedObjects }
6258
catch { Stop-PSFFunction -String 'Get-AdsAcl.ObjectError' -StringValues $pathItem -Target $pathItem -EnableException $EnableException -Cmdlet $PSCmdlet -ErrorRecord $_ -Continue }
6359
$aclObject = $adObject.ntSecurityDescriptor
60+
if (-not $aclObject) {
61+
Stop-PSFFunction -String 'Get-AdsAcl.NoSecurityProperty' -StringValues $pathItem -Target $pathItem -EnableException $EnableException -Cmdlet $PSCmdlet -Category PermissionDenied -Continue
62+
}
63+
6464
Add-Member -InputObject $aclObject -MemberType NoteProperty -Name DistinguishedName -Value $adObject.DistinguishedName -Force
6565
$aclObject
6666
}

0 commit comments

Comments
 (0)