Fix errors gathering the forest SID
Pull the SID directly from the 'krbtgt' user to avoid errors in ConvertTo-SID
This commit is contained in:
parent
94438eda67
commit
d1060930c7
|
|
@ -3891,10 +3891,10 @@ to the forest root domain SID.
|
||||||
if ($ForestObject) {
|
if ($ForestObject) {
|
||||||
# get the SID of the forest root
|
# get the SID of the forest root
|
||||||
if ($PSBoundParameters['Credential']) {
|
if ($PSBoundParameters['Credential']) {
|
||||||
$ForestSid = ConvertTo-SID -ObjectName "krbtgt@$($ForestObject.RootDomain)" -Credential $Credential
|
$ForestSid = (Get-DomainUser -Identity "krbtgt" -Domain $ForestObject.RootDomain.Name -Credential $Credential).objectsid
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ForestSid = ConvertTo-SID -ObjectName "krbtgt@$($ForestObject.RootDomain)"
|
$ForestSid = (Get-DomainUser -Identity "krbtgt" -Domain $ForestObject.RootDomain.Name).objectsid
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parts = $ForestSid -Split '-'
|
$Parts = $ForestSid -Split '-'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue