Encryption 是否生成所有自签名证书的列表?

Encryption 是否生成所有自签名证书的列表?,encryption,certificate,Encryption,Certificate,我正在尝试使用Powershell生成环境中所有自签名证书的列表 我需要将脚本的这一部分定向到多台机器(IP地址),但我不知道如何做到这一点: dir cert: -Recurse | where {$_.subject -ne $null} | where {$_.subject -eq $_.issuer} | Export-Csv -NoTypeInformation -Encoding UTF8 -delimiter ';' -path .\ssc_export dir证书:-递归|

我正在尝试使用Powershell生成环境中所有自签名证书的列表

我需要将脚本的这一部分定向到多台机器(IP地址),但我不知道如何做到这一点:

dir cert: -Recurse |
where {$_.subject -ne $null} |
where {$_.subject -eq $_.issuer} |
Export-Csv -NoTypeInformation -Encoding UTF8 -delimiter ';' -path .\ssc_export
dir证书:-递归|
其中{$\ subject-ne$null}|
其中{$\.subject-eq$\.issuer}|
导出Csv-NoTypeInformation-Encoding UTF8-分隔符“;”-路径。\ssc\u导出
Powershell不是我的强项,但它是我在这个环境中可以使用的全部。如有任何见解,将不胜感激

假设您拥有所需的权限,这将起作用:

$computers=获取内容-路径“R:\computers.txt”
$Results=@()
ForEach($Computers in$Computers){
$Results+=Invoke命令-ComputerName$Computer-ScriptBlock{
$storeNames=@();
foreach($存储在Get ChildItem中-路径“cert:CurrentUser”`
|其中对象{$\名称-ne'UserDS'}` \过滤器UserDS:https://stackoverflow.com/questions/57116536/powershell-fails-when-trying-to-read-certificate-store-with-the-specified-netwo/57278095#57278095
){
$storeNames+=“cert:CurrentUser\$($store.Name)”;
}
foreach($storein Get ChildItem-Path“cert:LocalMachine”){
$storeNames+=“cert:LocalMachine\$($store.Name)”;
}
$storeNames |%{Get ChildItem-Path$\`
|其中{$\ subject-ne$null}`
|其中{$\.subject-eq$\.issuer}`
|选择对象-属性`
@{Name=“Computer”;表达式={$env:COMPUTERNAME}`
@{Name=“Path”表达式={$\ pParentPath}`
@{Name=“Subject”表达式={$\ Subject}`
@{Name=“Issuer”表达式={$\u.Issuer}`
|格式表
};       
}
$Results
假设您拥有所需的权限,这将起作用:

$computers=获取内容-路径“R:\computers.txt”
$Results=@()
ForEach($Computers in$Computers){
$Results+=Invoke命令-ComputerName$Computer-ScriptBlock{
$storeNames=@();
foreach($存储在Get ChildItem中-路径“cert:CurrentUser”`
|其中对象{$\名称-ne'UserDS'}` \过滤器UserDS:https://stackoverflow.com/questions/57116536/powershell-fails-when-trying-to-read-certificate-store-with-the-specified-netwo/57278095#57278095
){
$storeNames+=“cert:CurrentUser\$($store.Name)”;
}
foreach($storein Get ChildItem-Path“cert:LocalMachine”){
$storeNames+=“cert:LocalMachine\$($store.Name)”;
}
$storeNames |%{Get ChildItem-Path$\`
|其中{$\ subject-ne$null}`
|其中{$\.subject-eq$\.issuer}`
|选择对象-属性`
@{Name=“Computer”;表达式={$env:COMPUTERNAME}`
@{Name=“Path”表达式={$\ pParentPath}`
@{Name=“Subject”表达式={$\ Subject}`
@{Name=“Issuer”表达式={$\u.Issuer}`
|格式表
};       
}
$Results