From 3632e54ef2664cb4424faeec04cfdc8fd35269a9 Mon Sep 17 00:00:00 2001 From: Mario C Date: Fri, 13 Nov 2026 11:31:15 -0500 Subject: [PATCH 1/5] Add AD CS enrollment prerequisite analysis --- ...rtTo-MtAdcsEnrollmentPrerequisiteState.ps1 | 101 ++++++++++++++++++ ...tAdcsEnrollmentPrerequisiteState.Tests.ps1 | 75 +++++++++++++ tests/ad/security/Test.AD-CS-01.md | 28 +++++ tests/ad/security/Test.AD-CS-01.ps1 | 47 ++++++++ 4 files changed, 251 insertions(+) create mode 100644 powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 create mode 100644 powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 create mode 100644 tests/ad/security/Test.AD-CS-01.md create mode 100644 tests/ad/security/Test.AD-CS-01.ps1 diff --git a/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 new file mode 100644 index 0000000000..4637b4cb09 --- /dev/null +++ b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 @@ -0,0 +1,101 @@ +function ConvertTo-MtAdcsEnrollmentPrerequisiteState { + [CmdletBinding()] + [OutputType([PSCustomObject])] + param( + [Parameter(Mandatory)] + [AllowNull()] + [PSCustomObject] $Configuration + ) + + $clientAuthenticationOids = @( + '1.3.6.1.5.5.7.3.2', + '1.3.6.1.4.1.311.20.2.2', + '1.3.6.1.5.2.3.4', + '2.5.29.37.0' + ) + $enrolleeSuppliesSubjectFlag = 0x00000001 + $pendAllRequestsFlag = 0x00000002 + + if ($null -eq $Configuration) { + return [PSCustomObject]@{ + EvidenceAvailable = $false + Disposition = 'Inconclusive' + Templates = @() + EligibleCount = 0 + PotentiallyEligibleCount = 0 + InconclusiveCount = 0 + } + } + + $enterpriseCas = @($Configuration.EnterpriseCAs) + $templates = @($Configuration.CertificateTemplates) + if ($null -eq $Configuration.EnterpriseCAs -or $null -eq $Configuration.CertificateTemplates) { + return [PSCustomObject]@{ + EvidenceAvailable = $false + Disposition = 'Inconclusive' + Templates = @() + EligibleCount = 0 + PotentiallyEligibleCount = 0 + InconclusiveCount = 0 + } + } + + $publishedBy = @{} + foreach ($ca in $enterpriseCas) { + foreach ($templateName in @($ca.certificateTemplates)) { + $name = [string](ConvertFrom-MtLdapValue $templateName) + if ([string]::IsNullOrWhiteSpace($name)) { continue } + if (-not $publishedBy.ContainsKey($name)) { $publishedBy[$name] = [System.Collections.Generic.List[string]]::new() } + $caName = [string](ConvertFrom-MtLdapValue $ca.Name) + if ([string]::IsNullOrWhiteSpace($caName)) { $caName = [string](ConvertFrom-MtLdapValue $ca.DistinguishedName) } + $publishedBy[$name].Add($caName) + } + } + + $facts = foreach ($template in $templates) { + $name = [string](ConvertFrom-MtLdapValue $template.Name) + $ekuValues = @($template.'pKIExtendedKeyUsage' | ForEach-Object { [string](ConvertFrom-MtLdapValue $_) }) + $enrollmentFlagRaw = ConvertFrom-MtLdapValue $template.'msPKI-Enrollment-Flag' + $nameFlagRaw = ConvertFrom-MtLdapValue $template.'msPKI-Certificate-Name-Flag' + $enrollmentFlag = if ($null -eq $enrollmentFlagRaw) { $null } else { [int64]$enrollmentFlagRaw } + $nameFlag = if ($null -eq $nameFlagRaw) { $null } else { [int64]$nameFlagRaw } + $published = $publishedBy.ContainsKey($name) + $authenticationCapable = @($ekuValues | Where-Object { $_ -in $clientAuthenticationOids }).Count -gt 0 + $suppliesSubject = $null -ne $nameFlag -and (($nameFlag -band $enrolleeSuppliesSubjectFlag) -ne 0) + $managerApprovalRequired = $null -ne $enrollmentFlag -and (($enrollmentFlag -band $pendAllRequestsFlag) -ne 0) + $securityDescriptorAvailable = $null -ne $template.nTSecurityDescriptor + + $disposition = if (-not $published -or -not $authenticationCapable -or -not $suppliesSubject -or $managerApprovalRequired) { + 'PrerequisitesNotSatisfied' + } + elseif (-not $securityDescriptorAvailable) { + 'Inconclusive' + } + else { + 'PotentiallyEligible' + } + + [PSCustomObject]@{ + Name = $name + Published = $published + PublishedBy = if ($published) { @($publishedBy[$name]) } else { @() } + AuthenticationCapable = $authenticationCapable + EnrolleeSuppliesSubject = $suppliesSubject + ManagerApprovalRequired = $managerApprovalRequired + SecurityDescriptorAvailable = $securityDescriptorAvailable + Disposition = $disposition + } + } + + $eligible = @($facts | Where-Object Disposition -eq 'Eligible').Count + $potential = @($facts | Where-Object Disposition -eq 'PotentiallyEligible').Count + $inconclusive = @($facts | Where-Object Disposition -eq 'Inconclusive').Count + [PSCustomObject]@{ + EvidenceAvailable = $true + Disposition = if ($potential -gt 0) { 'PotentiallyEligible' } elseif ($inconclusive -gt 0) { 'Inconclusive' } else { 'PrerequisitesNotSatisfied' } + Templates = @($facts) + EligibleCount = $eligible + PotentiallyEligibleCount = $potential + InconclusiveCount = $inconclusive + } +} \ No newline at end of file diff --git a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 new file mode 100644 index 0000000000..3677c2c71d --- /dev/null +++ b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 @@ -0,0 +1,75 @@ +BeforeAll { + $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '../../../..') + . (Join-Path $repoRoot 'powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1') + function ConvertFrom-MtLdapValue { param($Value) return $Value } +} + +Describe 'ConvertTo-MtAdcsEnrollmentPrerequisiteState' { + It 'returns inconclusive when configuration evidence is unavailable' { + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $null + $result.EvidenceAvailable | Should -BeFalse + $result.Disposition | Should -Be 'Inconclusive' + } + + It 'correlates publication and template prerequisites' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @([PSCustomObject]@{ Name='CA01'; certificateTemplates=@('UserAuth') }) + CertificateTemplates = @([PSCustomObject]@{ + Name='UserAuth' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=0 + 'msPKI-Certificate-Name-Flag'=1 + nTSecurityDescriptor=[PSCustomObject]@{} + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.PotentiallyEligibleCount | Should -Be 1 + $result.Templates[0].PublishedBy | Should -Contain 'CA01' + } + + It 'does not classify an unpublished template as potentially eligible' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @() + CertificateTemplates = @([PSCustomObject]@{ + Name='Unpublished' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=0 + 'msPKI-Certificate-Name-Flag'=1 + nTSecurityDescriptor=[PSCustomObject]@{} + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.Templates[0].Disposition | Should -Be 'PrerequisitesNotSatisfied' + } + + It 'does not classify a template requiring manager approval as potentially eligible' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @([PSCustomObject]@{ Name='CA01'; certificateTemplates=@('Approval') }) + CertificateTemplates = @([PSCustomObject]@{ + Name='Approval' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=2 + 'msPKI-Certificate-Name-Flag'=1 + nTSecurityDescriptor=[PSCustomObject]@{} + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.Templates[0].ManagerApprovalRequired | Should -BeTrue + $result.Templates[0].Disposition | Should -Be 'PrerequisitesNotSatisfied' + } + + It 'keeps missing security descriptor evidence inconclusive' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @([PSCustomObject]@{ Name='CA01'; certificateTemplates=@('UnknownAcl') }) + CertificateTemplates = @([PSCustomObject]@{ + Name='UnknownAcl' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=0 + 'msPKI-Certificate-Name-Flag'=1 + nTSecurityDescriptor=$null + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.Templates[0].Disposition | Should -Be 'Inconclusive' + } +} \ No newline at end of file diff --git a/tests/ad/security/Test.AD-CS-01.md b/tests/ad/security/Test.AD-CS-01.md new file mode 100644 index 0000000000..844a1c2bf3 --- /dev/null +++ b/tests/ad/security/Test.AD-CS-01.md @@ -0,0 +1,28 @@ +Evaluates whether an enterprise CA publishes certificate templates whose collected configuration matches prerequisites commonly associated with certificate-based identity abuse. + +#### Control Type + +**Operational** + +#### Security Recommendation + +- Review every published template that supports client authentication and lets the requester supply subject information. +- Require manager approval or authorized signatures where business workflows permit. +- Restrict Enroll and Autoenroll rights to explicitly approved principals. +- Remove unused templates from each enterprise CA. +- Treat a candidate as a configuration lead, not proof of successful enrollment or authentication. + +#### How the Test Works + +The test correlates enterprise CA `certificateTemplates` publication with each template's EKUs, enrollment flags, certificate-name flags, and security-descriptor availability. A template is reported for investigation when it is published, authentication-capable, allows enrollee-supplied subject information, does not require manager approval, and has authorization evidence available or unresolved. + +The test deliberately distinguishes observed prerequisites from exploitability. It does not enroll a certificate, generate or export a private key, perform PKINIT, or claim that an attack path was executed. + +#### Result Interpretation + +- **PrerequisitesNotSatisfied**: at least one modeled condition is disproven. +- **PotentiallyEligible**: dangerous template and publication conditions exist, with ACL evidence available for follow-up. +- **Inconclusive**: required authorization evidence is unavailable. + + +%TestResult% \ No newline at end of file diff --git a/tests/ad/security/Test.AD-CS-01.ps1 b/tests/ad/security/Test.AD-CS-01.ps1 new file mode 100644 index 0000000000..1ffb8d047d --- /dev/null +++ b/tests/ad/security/Test.AD-CS-01.ps1 @@ -0,0 +1,47 @@ +function Test-MtAdcsPublishedTemplatePrerequisites { + [MaesterTest( + Id = 'AD-CS-01', + Title = 'Published AD CS templates should not expose dangerous enrollment prerequisites', + Product = 'ad', + Feature = 'certificate-services', + Area = 'infrastructure', + ResourceType = 'CertificateTemplate', + Severity = 'High', + UserImpact = 'Low', + ImplementationCost = 'Medium', + Mitre = 'T1649', + Service = 'ActiveDirectory', + Permission = ('ActiveDirectory:Ldap:Configuration/*:ReadProperty'), + Author = 'Mario Contestabile' + )] + [CmdletBinding()] + [OutputType([bool])] + param() + + $adState = Get-MtADDomainState -Categories @('Configuration') + if ($null -eq $adState -or $null -eq $adState.Configuration) { + Add-MtTestResultDetail -SkippedBecause NotConnectedActiveDirectory + return $null + } + + $state = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $adState.Configuration + if (-not $state.EvidenceAvailable) { + Add-MtTestResultDetail -Result 'Required AD CS publication or template evidence was unavailable.' -Investigate + return $null + } + + $candidates = @($state.Templates | Where-Object Disposition -in @('PotentiallyEligible','Eligible','Inconclusive')) + $result = "| Template | Published | Authentication capable | Supplies subject | Manager approval | ACL evidence | Disposition |`n" + $result += "| --- | --- | --- | --- | --- | --- | --- |`n" + foreach ($candidate in $candidates) { + $result += "| $($candidate.Name) | $($candidate.Published) | $($candidate.AuthenticationCapable) | $($candidate.EnrolleeSuppliesSubject) | $($candidate.ManagerApprovalRequired) | $($candidate.SecurityDescriptorAvailable) | $($candidate.Disposition) |`n" + } + + if ($candidates.Count -eq 0) { + Add-MtTestResultDetail -Result 'No published certificate template matched the modeled dangerous enrollment prerequisites.' + return $true + } + + Add-MtTestResultDetail -Result "Published template candidates require authorization review. Configuration prerequisites do not prove exploitation.`n`n$result" -Investigate + return $null +} \ No newline at end of file From 55ddbae898ecf513cd87c2c5af9d9f44acffd312 Mon Sep 17 00:00:00 2001 From: Mario C Date: Thu, 19 Nov 2026 12:23:22 -0500 Subject: [PATCH 2/5] fix(ad): treat missing AD CS flag evidence as inconclusive --- ...rtTo-MtAdcsEnrollmentPrerequisiteState.ps1 | 13 +++++-- ...tAdcsEnrollmentPrerequisiteState.Tests.ps1 | 36 +++++++++++++++++-- tests/ad/security/Test.AD-CS-01.md | 2 +- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 index 4637b4cb09..9fa1a7023f 100644 --- a/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 +++ b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 @@ -1,4 +1,4 @@ -function ConvertTo-MtAdcsEnrollmentPrerequisiteState { +function ConvertTo-MtAdcsEnrollmentPrerequisiteState { [CmdletBinding()] [OutputType([PSCustomObject])] param( @@ -65,9 +65,18 @@ $managerApprovalRequired = $null -ne $enrollmentFlag -and (($enrollmentFlag -band $pendAllRequestsFlag) -ne 0) $securityDescriptorAvailable = $null -ne $template.nTSecurityDescriptor - $disposition = if (-not $published -or -not $authenticationCapable -or -not $suppliesSubject -or $managerApprovalRequired) { + $disposition = if (-not $published -or -not $authenticationCapable) { 'PrerequisitesNotSatisfied' } + elseif ($null -ne $nameFlag -and -not $suppliesSubject) { + 'PrerequisitesNotSatisfied' + } + elseif ($null -ne $enrollmentFlag -and $managerApprovalRequired) { + 'PrerequisitesNotSatisfied' + } + elseif ($null -eq $nameFlag -or $null -eq $enrollmentFlag) { + 'Inconclusive' + } elseif (-not $securityDescriptorAvailable) { 'Inconclusive' } diff --git a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 index 3677c2c71d..63bec7f98c 100644 --- a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 +++ b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '../../../..') . (Join-Path $repoRoot 'powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1') function ConvertFrom-MtLdapValue { param($Value) return $Value } @@ -72,4 +72,36 @@ Describe 'ConvertTo-MtAdcsEnrollmentPrerequisiteState' { $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration $result.Templates[0].Disposition | Should -Be 'Inconclusive' } -} \ No newline at end of file + It 'keeps missing certificate-name flag evidence inconclusive' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @([PSCustomObject]@{ Name='CA01'; certificateTemplates=@('UnknownNameFlag') }) + CertificateTemplates = @([PSCustomObject]@{ + Name='UnknownNameFlag' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=0 + 'msPKI-Certificate-Name-Flag'=$null + nTSecurityDescriptor=[PSCustomObject]@{} + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.Templates[0].Disposition | Should -Be 'Inconclusive' + $result.PotentiallyEligibleCount | Should -Be 0 + $result.InconclusiveCount | Should -Be 1 + } + + It 'keeps missing enrollment flag evidence inconclusive' { + $configuration = [PSCustomObject]@{ + EnterpriseCAs = @([PSCustomObject]@{ Name='CA01'; certificateTemplates=@('UnknownEnrollmentFlag') }) + CertificateTemplates = @([PSCustomObject]@{ + Name='UnknownEnrollmentFlag' + 'pKIExtendedKeyUsage'=@('1.3.6.1.5.5.7.3.2') + 'msPKI-Enrollment-Flag'=$null + 'msPKI-Certificate-Name-Flag'=1 + nTSecurityDescriptor=[PSCustomObject]@{} + }) + } + $result = ConvertTo-MtAdcsEnrollmentPrerequisiteState -Configuration $configuration + $result.Templates[0].Disposition | Should -Be 'Inconclusive' + $result.PotentiallyEligibleCount | Should -Be 0 + $result.InconclusiveCount | Should -Be 1 + }} diff --git a/tests/ad/security/Test.AD-CS-01.md b/tests/ad/security/Test.AD-CS-01.md index 844a1c2bf3..852e5f7f9b 100644 --- a/tests/ad/security/Test.AD-CS-01.md +++ b/tests/ad/security/Test.AD-CS-01.md @@ -22,7 +22,7 @@ The test deliberately distinguishes observed prerequisites from exploitability. - **PrerequisitesNotSatisfied**: at least one modeled condition is disproven. - **PotentiallyEligible**: dangerous template and publication conditions exist, with ACL evidence available for follow-up. -- **Inconclusive**: required authorization evidence is unavailable. +- **Inconclusive**: required configuration or authorization evidence is unavailable. %TestResult% \ No newline at end of file From 2f2567f276f051aacfc467aa5fc27fb29c0cc7a3 Mon Sep 17 00:00:00 2001 From: Mario C Date: Thu, 19 Nov 2026 12:31:36 -0500 Subject: [PATCH 3/5] fix(ad): use certificate authority resource type --- tests/ad/security/Test.AD-CS-01.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ad/security/Test.AD-CS-01.ps1 b/tests/ad/security/Test.AD-CS-01.ps1 index 1ffb8d047d..ba9bdc783b 100644 --- a/tests/ad/security/Test.AD-CS-01.ps1 +++ b/tests/ad/security/Test.AD-CS-01.ps1 @@ -1,11 +1,11 @@ -function Test-MtAdcsPublishedTemplatePrerequisites { +function Test-MtAdcsPublishedTemplatePrerequisites { [MaesterTest( Id = 'AD-CS-01', Title = 'Published AD CS templates should not expose dangerous enrollment prerequisites', Product = 'ad', Feature = 'certificate-services', Area = 'infrastructure', - ResourceType = 'CertificateTemplate', + ResourceType = 'CertificateAuthority', Severity = 'High', UserImpact = 'Low', ImplementationCost = 'Medium', From 3f69108ac1afd8191bf9233e579f46bdabf226bc Mon Sep 17 00:00:00 2001 From: Mario C Date: Thu, 19 Nov 2026 14:54:08 -0500 Subject: [PATCH 4/5] fix(ad): restore required UTF-8 BOM --- tests/ad/security/Test.AD-CS-01.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ad/security/Test.AD-CS-01.ps1 b/tests/ad/security/Test.AD-CS-01.ps1 index ba9bdc783b..b34fee172c 100644 --- a/tests/ad/security/Test.AD-CS-01.ps1 +++ b/tests/ad/security/Test.AD-CS-01.ps1 @@ -1,4 +1,4 @@ -function Test-MtAdcsPublishedTemplatePrerequisites { +function Test-MtAdcsPublishedTemplatePrerequisites { [MaesterTest( Id = 'AD-CS-01', Title = 'Published AD CS templates should not expose dangerous enrollment prerequisites', From 5aac317918f31ef7c7769c072d31fad8dc919653 Mon Sep 17 00:00:00 2001 From: Mario C Date: Thu, 19 Nov 2026 15:06:22 -0500 Subject: [PATCH 5/5] fix(ad): restore UTF-8 BOMs for AD CS files --- .../services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 | 2 +- .../ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 index 9fa1a7023f..7486f4fcc7 100644 --- a/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 +++ b/powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1 @@ -1,4 +1,4 @@ -function ConvertTo-MtAdcsEnrollmentPrerequisiteState { +function ConvertTo-MtAdcsEnrollmentPrerequisiteState { [CmdletBinding()] [OutputType([PSCustomObject])] param( diff --git a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 index 63bec7f98c..a4ff0adaac 100644 --- a/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 +++ b/powershell/tests/ad/collection/ConvertTo-MtAdcsEnrollmentPrerequisiteState.Tests.ps1 @@ -1,4 +1,4 @@ -BeforeAll { +BeforeAll { $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '../../../..') . (Join-Path $repoRoot 'powershell/internal/services/ad/ConvertTo-MtAdcsEnrollmentPrerequisiteState.ps1') function ConvertFrom-MtLdapValue { param($Value) return $Value }