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:
Mike Brancato 2017-01-04 23:23:25 -05:00 committed by GitHub
parent 94438eda67
commit d1060930c7
1 changed files with 2 additions and 2 deletions

View File

@ -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 '-'