title: use if-elseif -else with input from compare-object
body: <p>I am comparing 2 <em>.csv</em> files and outputting the result to another <em>.csv</em> file. I can't seem to figure out how to further handle the compare-object result to be used in the <code>if..elseif...else{}</code> statement to print the result based on the <code>sideIndicator</code> result. Please further advise. Is there any catch I need to include to make sure the script will be handled properly?</p>
  
  <pre><code>clear-host
  $northdb = Import-Csv "C:\temp\cep\Book1.csv" -Header "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" | Sort-object -Property "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" -unique 
  $sdb = Import-Csv "C:\temp\cep\Book2.csv" -Header "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" | Sort-object -Property "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" -unique
  $result = Compare-Object $northdb $sdb -Property  "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" -PassThru | 
  if ($_SideIndicator -eq '=&gt;') {Select-Object  "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" | export-csv C:\temp\cep\gogo.csv -NoTypeInfo} 
  elseif ($_.sideIndicator -eq '=&gt;') {Select-Object  "InstanceName", "DatabaseName", "PrinicipalName", "PrinicipalType", "Permission", "ObjectTypeLevel", "ObjectName" | export-csv C:\temp\cep\gogo.csv -NoTypeInfo} 
  else {write-host "there is no changes"}
  </code></pre>