
PowerShell で証明書を作成します。最初はルートで、次に発行元が必要です。
証明書を「*.pfx」ファイルにエクスポートし、そこからインストールすると、ルートはルート フォルダーに配置されて問題ありませんが、2 番目は「信頼された発行元」ではなくパブリックに配置されます。
2番目をデフォルトで「信頼できる発行元」にインストールするにはどうすればよいですか?
可能であれば。
答え1
PowerShell で簡単な関数を作成しました:
$in_cert = "C:\Users\Marian\Desktop\Pfx Certificate.pfx";
$password = Read-Host -AsSecureString;
# Read the pfx certificate data:
$pfx = (Get-PfxData -FilePath $in_cert -Password $password -ErrorAction Stop);
# Get the root and publisher certificate:
$root = $pfx.OtherCertificates[0];
$publisher = $pfx.EndEntityCertificates[0];
# Add the root:
$rootStore = Get-Item "Cert:\CurrentUser\Root";
$rootStore.Open('ReadWrite');
$rootStore.add($root);
$rootStore.close();
# Add the publisher:
$rootStore = Get-Item "Cert:\CurrentUser\TrustedPublisher";
$rootStore.Open('ReadWrite');
$rootStore.add($publisher);
$rootStore.close();
Pause;
「ルート警告」をスキップするには、「Cert:\LocalMachine」と「管理者として実行」を使用します。