如何使用 PowerShell 將證書安裝到證書儲存中?
要使用 PowerShell 安裝證書,我們需要使用 **Import-Certificate** 命令。例如,我們有一個儲存在 C:\temp\Mycert.cer 位置的證書,需要將它安裝到本地計算機的 Personal 儲存區中。
示例
Import-Certificate -FilePath C:\Temp\Mycert.cer ` -CertStoreLocation Cert:\LocalMachine\My\
你還可以使用以下方法。
PS C:\> Set-Location Cert:\LocalMachine\My\ PS Cert:\LocalMachine\My\> Import-Certificate -FilePath C:\Temp\Mycert.cer
要安裝到遠端計算機的證書,請使用 **Invoke-Command** 方法。
語法
Invoke-Command -ComputerName RemoteServer1 -ScriptBlock {Import-Certificate -FilePath C:\Temp\Mycert.cer `
-CertStoreLocation Cert:\LocalMachine\My\ }上述命令會將證書從遠端伺服器的路徑 **C:\temp** 安裝到 RemoteServer1 的遠端計算機的個人儲存區中。
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP