FriendlyName is not returning the Template name

Welcome Forums General PowerShell Q&A FriendlyName is not returning the Template name

Viewing 3 reply threads
  • Author
    Posts
    • #47692
      Participant
      Topics: 23
      Replies: 26
      Points: 0
      Rank: Member

      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
      Participant
      Topics: 18
      Replies: 573
      Points: 32
      Rank: Member

      Explore the extensions property of the certificates.

    • #47741
      Participant
      Topics: 23
      Replies: 26
      Points: 0
      Rank: Member

      Any link \ URL pls.

    • #47747
      Participant
      Topics: 18
      Replies: 573
      Points: 32
      Rank: Member
Viewing 3 reply threads
  • The topic ‘FriendlyName is not returning the Template name’ is closed to new replies.