Convert-LDAPProperty now properly parses sidHistory with multiple values

This commit is contained in:
HarmJ0y 2017-06-16 16:43:23 -04:00
parent 035166385e
commit d0e4e270f1
1 changed files with 3 additions and 3 deletions

View File

@ -2790,8 +2790,8 @@ A custom PSObject with LDAP hashtable properties translated.
$Properties.PropertyNames | ForEach-Object { $Properties.PropertyNames | ForEach-Object {
if ($_ -ne 'adspath') { if ($_ -ne 'adspath') {
if (($_ -eq 'objectsid') -or ($_ -eq 'sidhistory')) { if (($_ -eq 'objectsid') -or ($_ -eq 'sidhistory')) {
# convert the SID to a string # convert all listed sids (i.e. if multiple are listed in sidHistory)
$ObjectProperties[$_] = (New-Object System.Security.Principal.SecurityIdentifier($Properties[$_][0], 0)).Value $ObjectProperties[$_] = $Properties[$_] | ForEach-Object { (New-Object System.Security.Principal.SecurityIdentifier($_, 0)).Value }
} }
elseif ($_ -eq 'grouptype') { elseif ($_ -eq 'grouptype') {
$ObjectProperties[$_] = $Properties[$_][0] -as $GroupTypeEnum $ObjectProperties[$_] = $Properties[$_][0] -as $GroupTypeEnum
@ -6374,7 +6374,7 @@ https://blogs.technet.microsoft.com/pie/2014/08/25/metadata-1-when-did-the-deleg
} }
} }
else { else {
Write-Verbose "[Get-DomainObjectHistory] Error retrieving 'msds-replattributemetadata' for '$ObjectDN'" Write-Verbose "[Get-DomainObjectAttributeHistory] Error retrieving 'msds-replattributemetadata' for '$ObjectDN'"
} }
} }
} }