Для проверки цифровой подписи сборок я использую Windows PowerShell Get-AuthenticodeSignature
.
Get-ChildItem -File -Path "C:\Program Files (x86)\My Company\My Product\Components\Microsoft.*.dll" -Recurse |
Get-AuthenticodeSignature |
Select-Object -Property Path, Status,
@{Name='SubjectName';Expression={($_.SignerCertificate.Subject)}}
В поле вывода SubjectName слишком много пар имя / значение:
Path Status SubjectName
---- ------ -----------
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.Expression.Drawing.dll NotSigned
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.Expression.Interactions.dll NotSigned
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.ReportViewer.Common.dll Valid CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.ReportViewer.DataVisualization.dll Valid CN=Microsoft Corporation, OU=MOPR, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Как можноЯ уменьшаю вывод до единственного значения: «Microsoft Corporation»? Выходной файл, который я хотел бы получить, имеет вид CSV:
Path,Status,SubjectName
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.Expression.Drawing.dll,NotSigned,
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.Expression.Interactions.dll,NotSigned,
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.ReportViewer.Common.dll,Valid,Microsoft Corporation
C:\Program Files (x86)\My Company\My Product\Components\Microsoft.ReportViewer.DataVisualization.dll,Valid,Microsoft Corporation