Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions WHFBCHECKS/private/Get-WHFBCA.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,31 @@ function get-WHFBCA {
if ($ca.Children.cn.count -gt 1) {
$res = [System.Collections.ArrayList]::new()
foreach ($c in $ca) {
$CASvr = get-adcomputer $c.cn.ToString() -properties *
$caa = [PSCustomObject]@{
Name = $c.cn
CAName = $c.children.cn[0]
OSVer = [decimal]$CASvr.OperatingSystemVersion.split(' ')[0]
try {
$CASvr = get-adcomputer $c.cn.ToString() -properties *
$caa = [PSCustomObject]@{
Name = $c.cn
CAName = $c.children.cn[0]
OSVer = [decimal]$CASvr.OperatingSystemVersion.split(' ')[0]
}
$res.Add($caa) | out-null
}
catch {
}
$res.Add($caa) | out-null
}
}
elseif ($ca.Children.cn.count -eq 1) {
$CASvr = get-adcomputer $ca.cn -properties *
$caa = [PSCustomObject]@{
Name = $ca.cn
CAName = $ca.children.cn[0]
OSVer = [decimal]$CASvr.OperatingSystemVersion.split(' ')[0]
try {
$CASvr = get-adcomputer $ca.cn -properties *
$caa = [PSCustomObject]@{
Name = $ca.cn
CAName = $ca.children.cn[0]
OSVer = [decimal]$CASvr.OperatingSystemVersion.split(' ')[0]
}
$res = $caa
}
catch {
}
$res = $caa
}
return $res
}
16 changes: 8 additions & 8 deletions WHFBCHECKS/public/test-WHFB.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ function Test-WHFB {
add-type -path "$($module.ModuleBase)\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
$AuthSessions = [Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache]::DefaultShared.ReadItems()
$authed = $false
foreach ($AuthSession in $AuthSessions) {
if ($AuthSession.clientid -eq "1b730954-1685-4b74-9bfd-dac224a7b894") {
if ($AuthSession.expireson -gt (Get-Date)) {
$authed = $true
}
}
}
#foreach ($AuthSession in $AuthSessions) {
# if ($AuthSession.clientid -eq "1b730954-1685-4b74-9bfd-dac224a7b894") {
# if ($AuthSession.expireson -gt (Get-Date)) {
# $authed = $true
# }
# }
#}
if (!$authed) {
Connect-MsolService
}
Expand Down Expand Up @@ -252,7 +252,7 @@ function Test-WHFB {
else {
foreach ($CertCRLDP in $CertCRLDPs) {
if ( ($CertCRLDP.Contains("(")) -and ($CertCRLDP.Contains(")")) ) {
$CertCRLDP = ($CertCRLDP.Substring(($CertCRLDP.IndexOf("(") + 1))).TrimEnd(")")
$CertCRLDP = ($CertCRLDP.Substring(0,($CertCRLDP.IndexOf("(")))).TrimEnd(")") + ".crl"
}
Write-FormattedHost -Message "CA KDC cert on Domain Controller $($DCC.PSComputerName) HTTP CRL is:" -ResultState Pass -ResultMessage $CertCRLDP
$CACRLValid = Get-WHFBCACRLValid -crl (Invoke-WebRequest -Uri $CertCRLDP -UseBasicParsing).content
Expand Down