Add scripts

This commit is contained in:
Alex Kup 2023-08-17 13:45:36 +03:00 committed by GitHub
parent 422934aef7
commit 350807c951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 574 additions and 0 deletions

View file

@ -0,0 +1,23 @@
function Get-WebCertificate ($srv) {
$iwr = iwr $srv
$status_code = $iwr.StatusCode
$status = $iwr.BaseResponse.StatusCode
$info = $iwr.BaseResponse.Server
$spm = [System.Net.ServicePointManager]::FindServicePoint($srv)
$date_end = $spm.Certificate.GetExpirationDateString()
$cert_name = ($spm.Certificate.Subject) -replace "CN="
$cert_owner = ((($spm.Certificate.Issuer) -split ", ") | where {$_ -match "O="}) -replace "O="
$Collections = New-Object System.Collections.Generic.List[System.Object]
$Collections.Add([PSCustomObject]@{
Host = $srv;
Server = $info;
Status = $status;
StatusCode = $status_code;
Certificate = $cert_name;
Issued = $cert_owner;
End = $date_end
})
$Collections
}
# Get-WebCertificate https://google.com