title: Save certificate thumbprint as a variable in powershell
body: <p>Powershell newblart here. I'm trying to save a thumbprint from a specific certificate as a variable for use later in a script. I've gotten far! but not far enough. I am able to filter the certificates by the cert template, so I've narrowed down to a single thumbprint displayed, but there is other output that is blocking me. I'm trying to use the split method (erroneously) to start chopping up the output. Here's what I have so far:</p>
  
  <pre><code>PS C:\Users\Administrator&gt; Get-ChildItem Cert:\LocalMachine\my | ? {$_.Extensions | ? {$_.oid.friendlyname -match "Template" -and $_.Format(0) -match "Kerberos Authentication"}}
  
  
      Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\my
  
  
  Thumbprint                                Subject
  ----------                                -------
  8635AF13624FEA042664BCDD0EC4661C7E07FA0F
  </code></pre>
  
  <p>What i need is just the thumbprint, not all the other output. 
  I'm trying to use split, but it looks like this output is not a string. This is there error i get with split. (here im just trying to split on a spave to see where that leads me, space may likely be the wrong thing to try and split on):</p>
  
  <pre><code>PS C:\Users\Administrator&gt; Get-ChildItem Cert:\LocalMachine\my | ? {$_.Extensions | ? {$_.oid.friendlyname -match "Template" -and $_.Format(0) -match "Kerberos Authentication"}} | %{ $_.Split(' ')[1]; }
  Method invocation failed because [System.Security.Cryptography.X509Certificates.X509Certificate2] doesn't contain a method named 'Split'.
  At line:1 char:157
  + ... cation"}} | %{ $_.Split(' ')[1]; }
  +                    ~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : MethodNotFound
  </code></pre>
  
  <p>Any help would be much appropriated. Thanks again.</p>