How can i split my output from undesired "content" for example
Get-ChildItem Cert:\LocalMachine\CA | Where-Object Subject -Match "Windows"
i get subject looking like this
CN=Microsoft Windows Hardware Compatibility, OU=Microsoft Corporation, OU=Microsoft Windows Hardware Compatibility Intermediate CA, OU=Copy....
How can i display only content without "CN=" , "OU=" but only like this, in a one-liner:
Microsoft Windows Hardware Compatibility Microsoft Corporation Microsoft Windows Hardware Compatibility Intermediate CA
CodePudding user response:
Is this what you are after?
Clear-Host
(
Get-ChildItem -Path 'Cert:\LocalMachine\CA' |
Where-Object Subject -Match 'Windows'
).Subject -replace ',|.[A-Z]='
# Results
<#
Microsoft Windows Hardware Compatibility Microsoft Corporation Microsoft Windows Hardware Compatibility Intermediate CA Copyright (c) 1997 Microsoft
Corp.
#>