Add scripts
This commit is contained in:
parent
422934aef7
commit
350807c951
30 changed files with 574 additions and 0 deletions
23
Scripts/Get-WebCertificate.psm1
Normal file
23
Scripts/Get-WebCertificate.psm1
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue