找不到路径“\LocalMachine\Personal”,因为它不存在
Cannot find path '\LocalMachine\Personal' because it does not exist
我正在尝试访问 IIS 10 商店上已安装证书的指纹。我正在使用以下命令
Get-ChildItem -path Cert:\LocalMachine\Personal
但是上面的命令给我以下错误
PS C:\Users\Administrator> Get-ChildItem -path Cert:\LocalMachine\Personal
Get-ChildItem : Cannot find path '\LocalMachine\Personal' because it does not exist.
At line:1 char:1
+ Get-ChildItem -path Cert:\LocalMachine\Personal
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\LocalMachine\Personal:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
但是,以下命令返回有效指纹
Get-ChildItem -path Cert:\LocalMachine\WebHosting
有趣的是,当我转到 IIS>Server Certificate 时,我可以看到有两个商店 WebHosting 和 Personal。
我查看了 microsoft documentation 并指出,这意味着有 WebHosting 和 Personal Store
The Web Hosting store works like the Personal store, so all of the
existing tools to import and export certificates work the same way.
The key difference between Web Hosting store and Personal store is
that Web Hosting store is designed to scale to higher numbers of
certificates.
谁能告诉我为什么 Get-ChildItem -path Cert:\LocalMachine\Personal
会抛出错误?
Personal
是 MMC 中的逻辑存储名称。在 PowerShell PSDrive 中,存储名称为 My
.
Get-ChildItem -path Cert:\LocalMachine\My
我说不出为什么会有所不同。但是,您可以 运行 在 Windows 系统上使用以下内容来发现其他命名差异:
certutil -enumstore
您可以进一步执行上述命令并创建您自己的命名不匹配映射:
(certutil -enumstore) -match '"[^"]+"' | Foreach-Object {
$PSStore,$MMCStore = ($_ -split '("[^"]+")').Trim(' ','"')[0,1]
[pscustomobject]@{ 'PSStore' = $PSStore; 'MMCStore' = $MMCStore }
}
我正在尝试访问 IIS 10 商店上已安装证书的指纹。我正在使用以下命令
Get-ChildItem -path Cert:\LocalMachine\Personal
但是上面的命令给我以下错误
PS C:\Users\Administrator> Get-ChildItem -path Cert:\LocalMachine\Personal
Get-ChildItem : Cannot find path '\LocalMachine\Personal' because it does not exist.
At line:1 char:1
+ Get-ChildItem -path Cert:\LocalMachine\Personal
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\LocalMachine\Personal:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
但是,以下命令返回有效指纹
Get-ChildItem -path Cert:\LocalMachine\WebHosting
有趣的是,当我转到 IIS>Server Certificate 时,我可以看到有两个商店 WebHosting 和 Personal。
我查看了 microsoft documentation 并指出,这意味着有 WebHosting 和 Personal Store
The Web Hosting store works like the Personal store, so all of the existing tools to import and export certificates work the same way. The key difference between Web Hosting store and Personal store is that Web Hosting store is designed to scale to higher numbers of certificates.
谁能告诉我为什么 Get-ChildItem -path Cert:\LocalMachine\Personal
会抛出错误?
Personal
是 MMC 中的逻辑存储名称。在 PowerShell PSDrive 中,存储名称为 My
.
Get-ChildItem -path Cert:\LocalMachine\My
我说不出为什么会有所不同。但是,您可以 运行 在 Windows 系统上使用以下内容来发现其他命名差异:
certutil -enumstore
您可以进一步执行上述命令并创建您自己的命名不匹配映射:
(certutil -enumstore) -match '"[^"]+"' | Foreach-Object {
$PSStore,$MMCStore = ($_ -split '("[^"]+")').Trim(' ','"')[0,1]
[pscustomobject]@{ 'PSStore' = $PSStore; 'MMCStore' = $MMCStore }
}