Files
SGU-CredentialProvider/scripts/Import-LabPeerCertificate.ps1
T

16 lines
565 B
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]$CertificatePath
)
$ErrorActionPreference = 'Stop'
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = [Security.Principal.WindowsPrincipal]::new($identity)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
throw 'Run this script from an elevated PowerShell session.'
}
$certificate = Import-Certificate -FilePath $CertificatePath -CertStoreLocation Cert:\LocalMachine\Root
$certificate | Select-Object Subject, Thumbprint, NotAfter