0

I am using certutil.exe to get a list of issued certificates and export them to a .txt file, the output comes back in rows even though i specify format-table, autosize or wrap options. here is the command i've used, where am I going wrong?

certutil.exe -view -restrict "Disposition=20" -out "Request.RequestID,Request.RequesterName,certificatehash,Request.SubmittedWhen" | Format-Table -autosize 

here is the output: (copied the first few here)

PS C:\Users\administrator.JLR> certutil.exe -view -restrict "Disposition=20" -out "Requ Schema:   Column Name                   Localized Name                Type    MaxLength  
----------------------------  ----------------------------  ------  ---------   Request.RequestID             Request ID                    Long    4 -- Indexed   Request.RequesterName         Requester Name    String  2048 -- Indexed   CertificateHash               Certificate Hash              String  128 -- Indexed   Request.SubmittedWhen       Request Submission Date       Date    8 -- Indexed

Row 1:   Request ID: 0x12 (18)   Requester Name: "JLR\QA-ADFS1$"   Certificate Hash: "13 24 46 54 fe 0b 6d 30 ff b8 b8 cd 55 e6 55 eb da 7d 15 bd"   Request Submission Date: 8/4/2015 10:24 AM

Row 2:   Request ID: 0x15 (21)   Requester Name: "JLR\svcSAM"   Certificate Hash: "94 2c 41 e0 2a d6 16 fc 74 bd ba 08 16 e8 a6 1c d2 4e 7e 12"   Request Submission Date: 8/4/2015 2:13 PM

Row 3:   Request ID: 0x17 (23)   Requester Name: "JLR\Administrator"   Certificate Hash: "24 b3 78 7b 69 db dc 6c d6 65 88 1c 7f b3 c6 ef 06 db 25 9b"   Request Submission Date: 8/4/2015 2:35 PM

Row 4:   Request ID: 0x25 (37)   Requester Name: "JLR\paul.charles"   Certificate Hash: "c4 00 20 df 0e 0b 65 29 b6 b3 c4 29 fa b7 a7 c6 c2 6b 44 c7"   Request Submission Date: 8/7/2015 3:31 PM
tarzanbappa
  • 4,930
  • 22
  • 75
  • 117
Teja
  • 43
  • 2
  • 9
  • "the output comes back in rows even though i specify format-table, autosize or wrap options" - that's because certutil does not return objects that `Format-Table` can work with, but raw text. You'll need to parse it manually, or use `ConvertFrom-String` (available in PowerShell 5.0) – Mathias R. Jessen Sep 18 '15 at 10:16
  • HI, Thanks for the response, but after looking at the convertfrom-string cmdlet, looks like it takes hello strings and converts it into a hash table. How ever, A hash table needs a key value pair, where the key is unique. So, that doesn't apply to my case here. Need all the repeated row key's to turn into column headers and corresponding values for those to line up as rows to those defined headers. for eg: Requestid requestername as column headers and all values listed opposite them as rows. – Teja Sep 18 '15 at 13:24
  • Don't confuse it with `ConvertFrom-StringData` (which produces a hashtable) – Mathias R. Jessen Sep 18 '15 at 13:27
  • 1
    No worries - If you find an appropriate solution to your problem, please post it as an answer here, and mark it "accepted" :) – Mathias R. Jessen Sep 18 '15 at 20:32

0 Answers0