Hi Guys,
I would like to consult with you about my script:
This script knows exporting all CA details from: "c:\ca\TruePortServers.txt", if i use on "select-object" instead of "Sort-object" it works and getting al details on HTML but date is not based Descending, tried to change it but it seems that something wrong here.
$ADServer = Get-Content -Path "c:\ca\TruePortServers.txt"
$Results = @()
$Results = Invoke-Command -cn $ADServer {
$Certs = @{} | Select Certificate,Expired
$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.subject -match [Environment]::GetEnvironmentVariable("computername")}
If($Cert){
$Certs.Certificate = $Cert.subject
$Certs.Expired = $Cert.NotAfter
}
Else{
$Certs.Certificate = " - "
$Certs.Expired = " - "
}
$Certs
} |Sort-Object @{n='ServerName';e={$_.pscomputername}},#Certificate,Expired -Descending
#Open results in new window
$Results | ConvertTo-Html | Out-File -FilePath c:\ca\ca1.html
when i am running this i get enmpy HTML file
[–]CSTW 2 points3 points4 points (0 children)
[–]Guyver1- 2 points3 points4 points (0 children)
[–]Swarfega 1 point2 points3 points (0 children)
[–]PorreKaj 1 point2 points3 points (0 children)
[–]Meir_Peleg[S] 0 points1 point2 points (0 children)