title: Copy 2 lines from many into a new file
body: <p>I have a text file which contains randomly generated data like this:</p>
  
  <pre><code>AllocatedStorage     : 5
  InstanceName         : testdatabase
  SnapshotName         : testdatabase-05-07-15-00-00
  CreateTime           : 05/07/2015 00:00:00 AM
  
  AllocatedStorage     : 10
  InstanceName         : testdb
  SnapshotName         : testdb-10-07-15-00-00
  CreateTime           : 10/07/2015 00:00:00 AM
  </code></pre>
  
  <p>I want to write both the snapshotname as well as createtime to be written to another file, of all the entries of this file like this:</p>
  
  <pre><code>SnapshotName         : testdatabase-05-07-15-00-00
  CreateTime           : 05/07/2015 00:00:00 AM
  SnapshotName         : testdb-10-07-15-00-00
  CreateTime           : 10/07/2015 00:00:00 AM
  </code></pre>
  
  <p>I am able to write snapshotname of all the entries, but not createtime. What I've tried so far is:</p>
  
  <pre><code>Get-Content "path\file.txt" | Where-Object {$_ -match 'SnapshotName'} | Set-Content "path\file2.txt"
  </code></pre>
  
  <p>I tried like adding another Where-Object to the above code like this, but failed to achieve the target.</p>
  
  <pre><code>Get-Content "path\file.txt" | Where-Object {$_ -match 'SnapshotName'} | Where-Object {$_ -match 'CreateTime'} | Set-Content "path\file2.txt"
  </code></pre>
  
  <p>I know I am missing something small. Can someone please help me how can I achieve what I said above.? Any response would be really appreciated.</p>