2016-11-03 4 views
1

私はpowershellですべての証明書を取得しようとしています。 "\ $ computer \ My"をスクリプトの下のストアの場所として設定すると、ユーザー証明書が返されると思います。powershellですべての証明書を取得するには?

"\ $ computer \ root"を設定すると、ルート証明書が返されます。ユーザー証明書とマシン証明書の両方を取得するにはどうすればよいですか?

$computer='localhost'; 
$ro=[System.Security.Cryptography.X509Certificates.OpenFlags]"ReadOnly" 
$lm=[System.Security.Cryptography.X509Certificates.StoreLocation]"LocalMachine" 
$store=new-object System.Security.Cryptography.X509Certificates.X509Store("\\$computer\My",$lm) 
$store.Open($ro) 
$certificates=$store.Certificates 
+3

をhttp://stackoverflow.com/questions/18712066/getting-local-machine- all-user-certificates-with-powershell) –

答えて

0

CurrentUserLocalMachineが含まれていPSDriveコマンドCertは、あります。

だから、これはあなたにすべての証明書を取得:([PowerShellを使用し、ローカルマシンとすべてのユーザーの証明書を取得する]の可能な複製を

Get-ChildItem Cert:\ -Recurse 
関連する問題