Author Posts

July 21, 2016 at 6:51 am

FriendlyName is not returning the Template name
All are ok only I need the certificate Template name. Given the Script below.
______________________________________________________________________________
$Computers = Get-Content D:\Biswajit-temp\dc_list.txt -ReadCount 0
$CompNum= $Computers.count
$Today = (Get-Date).ToString(“yyyy/MM/dd“)
$EightWeeks= (Get-Date).AddDays(+100).ToString(“yyyy/MM/dd“)
$a = ""
$a = $a + "BODY{background-color:#d6eaf8;font-family:verdana;font-size:8pt;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}"
$a = $a + ""
$i=0
Clear-content D:\Biswajit-temp\CertReport.htm
while($i –lt $CompNum)
{
Write-Host “Working on:” $Computers[$i]
$Certs = invoke-command –ComputerName $Computers[$i] –ScriptBlock {Get-ChildItem Cert:\LocalMachine\My -Recurse}
$CertCount=$certs.count
$j=0
while($j –lt $CertCount)
{
if (($Certs[$j].NotAfter –gt $Today) -and ($Certs[$j].NotAfter –lt $EightWeeks) )
{
$Certs[$j] | ConvertTo-Html -head $a -title “Certificate Expiry Information” -property PSComputerName,Subject,NotAfter,@{Label="Expires In (Days)";Expression={($_.NotAfter – (Get-Date)).Days}},FriendlyName,Thumbprint,SerialNumber >> D:\Biswajit-temp\CertReport.htm
}
++$j
}
++$i

}

if
((Get-Content “D:\Biswajit-temp\CertReport.htm”) –eq $Null)
{
Write-Host "N/A"
}
else
{

$body = Get-Content D:\Biswajit-temp\CertReport.htm -Raw
Send-MailMessage -To Biswajit.Biswas@contoso.com -from No-Reply@contoso.com -Subject "Certificate Report" -Body $body -BodyAsHtml -SmtpServer mail.contoso.com
}

July 21, 2016 at 11:24 am

Explore the extensions property of the certificates.

July 21, 2016 at 12:02 pm

Any link \ URL pls.