|
74 | 74 |
|
75 | 75 | param( |
76 | 76 | [Parameter(Mandatory)] |
| 77 | + [ValidateNotNullOrEmpty()] |
77 | 78 | [string]$OutputBaseDir, |
78 | 79 |
|
79 | 80 | [Parameter(Mandatory)] |
80 | | - [switch]$IncludeUnpublishedTemplates, |
| 81 | + [bool]$IncludeUnpublishedTemplates, |
81 | 82 |
|
82 | 83 | [Parameter(Mandatory)] |
83 | | - [switch]$SkipRemoteChecks, |
| 84 | + [bool]$SkipRemoteChecks, |
84 | 85 |
|
85 | 86 | [Parameter(Mandatory)] |
| 87 | + [ValidateNotNullOrEmpty()] |
86 | 88 | [string]$DirectoryServer, |
87 | 89 |
|
88 | 90 | [Parameter(Mandatory)] |
| 91 | + [ValidateNotNull()] |
89 | 92 | [PSCredential]$Credential |
90 | 93 | ) |
91 | 94 |
|
@@ -421,12 +424,21 @@ function Add-ESCFinding { |
421 | 424 | # --------------------------------------------------------------------- |
422 | 425 | $adSplat = New-MSADPTAdCommandSplat -Server $DirectoryServer -Credential $Credential |
423 | 426 |
|
| 427 | +# --------------------------------------------------------------------- |
| 428 | +# Pre-flight: AD connectivity check |
| 429 | +# --------------------------------------------------------------------- |
| 430 | +$rootDSE = Test-MSADPTADConnectivity -Credential $Credential -AdServer $DirectoryServer |
| 431 | +if (-not $rootDSE) { |
| 432 | + Write-Log -Message "Active Directory connectivity pre-flight failed. Aborting." -Level 'ERROR' |
| 433 | + exit 1 |
| 434 | +} |
| 435 | + |
424 | 436 | # --------------------------------------------------------------------- |
425 | 437 | # Enumerate AD CS / PKI objects |
426 | 438 | # --------------------------------------------------------------------- |
427 | 439 | try { |
428 | | - $rootDse = Get-ADRootDSE @adSplat -ErrorAction Stop |
429 | | - $configNc = $rootDse.configurationNamingContext |
| 440 | + #$rootDse = Get-ADRootDSE @adSplat -ErrorAction Stop |
| 441 | + $configNc = $rootDSE.configurationNamingContext |
430 | 442 |
|
431 | 443 | $templatesBase = "CN=Certificate Templates,CN=Public Key Services,CN=Services,$configNc" |
432 | 444 | $enrollmentBase = "CN=Enrollment Services,CN=Public Key Services,CN=Services,$configNc" |
|
0 commit comments