0
$Srv ='10.101.22.82' #remote server
$key = "SOFTWARE\\Microsoft\\SystemCertificates\\MY\\Certificates"
$type = [Microsoft.Win32.RegistryHive]::LocalMachine
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($type, $Srv)
$regKey = $regKey.OpenSubKey($key)
Write-Host "Sub Keys"
Write-Host "--------"
Foreach($sub in $regKey.GetSubKeyNames())
{
 #open the subkey here and parse the contents
 $myStr = "SOFTWARE\\Microsoft\\SystemCertificates\\MY\\Certificates\\"+$sub
 $regKey2 = $regKey.OpenSubKey($myStr)
 $bytes = $regKey2.GetValue($sub).Blob
 echo $bytes
 $cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]$bytes
 $cert | Select Subject, Issuer, NotBefore, NotAfter, Thumbprint, SerialNumber
} 

PowerShell を使用して、リモート レジストリを読み取り、SSL 証明書を取得しようとしています。私は何が欠けていますか?ポインタを高く評価しました、ありがとう

4

1 に答える 1