Skip to content

Commit 6df4845

Browse files
author
Uwe Gradenegger
committed
Optimizations and more returned Fields
1 parent 7647484 commit 6df4845

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Get-SANExtension.ps1

+8-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ process {
4343

4444
ForEach ($CertificateTemplate in $CertificateTemplates) {
4545

46-
Get-CADatabaseRecord `
46+
# Though this may not seem to be the best solution in the first place, DB processing time is limited
47+
# If we take too long, our Session gets killed.
48+
# Thus we first load all into memory which allows us to process the results as long as we need
49+
$DbFields = Get-CADatabaseRecord `
4750
-ConfigString $ConfigString `
4851
-Disposition Issued `
4952
-CertificateTemplate $CertificateTemplate `
50-
-Properties RequestId,Request.RequesterName,CommonName,RawCertificate | ForEach-Object -Process {
53+
-Properties RequestId,SerialNumber,NotBefore,NotAfter,Request.RequesterName,CommonName,RawCertificate
54+
55+
$DbFields | ForEach-Object -Process {
5156

5257
$CurrentRow = $_
5358
$CertificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
@@ -115,7 +120,7 @@ process {
115120

116121
}
117122

118-
} | Select-Object -Property RequestId,Request.RequesterName,CommonName,DNSName,IPAddress,UserPrincipalName
123+
} | Select-Object -Property CommonName,DNSName,IPAddress,UserPrincipalName,RequestId,Request.RequesterName,SerialNumber,NotBefore,NotAfter
119124
}
120125
}
121126
}

0 commit comments

Comments
 (0)