FriendlyName is not returning the Template name

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Dan Potter Dan Potter 4 months, 2 weeks ago.

  • Author
    Posts
  • #47692
    Profile photo of Biswajit
    Biswajit
    Participant

    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
    }

  • #47737
    Profile photo of Dan Potter
    Dan Potter
    Participant

    Explore the extensions property of the certificates.

  • #47741
    Profile photo of Biswajit
    Biswajit
    Participant

    Any link \ URL pls.

  • #47747
    Profile photo of Dan Potter
    Dan Potter
    Participant

You must be logged in to reply to this topic.