title: Powershell Switch - Multiple Clauses
body: <p>I'm creating a script that will be updating an Excel spreadsheet depending on conditions.</p>
  
  <p>This is what I currently have:</p>
  
  <pre><code>if ($endIRs -ne $null) {
  $endIRs | ForEach-Object {
      try {
          $classification = $_.Classification
          $priority = $_.Priority
          $title = $_.Title 
          $id = $_.Id
  
          switch ($classification) {
              {($_ -eq 'Reports') -and ($priority -eq '1')} {
              $GeAppsReportSheet.Cells.Item(8,2).Interior.ColorIndex = 3
              $GeAppsReportSheet.Cells.Item(8,2) = 'RED'
              }
              #more switch statements to go here
          }
       catch {#catch tickets with $classification not listed}
      }
  }
  </code></pre>
  
  <p>The <code>$endIRs</code> at the start holds a series of high priority 'incidents' that have been logged in the last 12 hours. If there is none, everything will be 'GREEN' which is set by default.</p>
  
  <p>What I am trying to achieve with the <code>switch</code> statement is <code>if (($classification -eq 'Reports') -and ($priority -eq '1')) {'change the cell colour and text'}</code> which I can do on its own, but I need it to check if the priority is "1" or "2" and do something different against the "Reports" classification cell in the spreadsheet.</p>
  
  <p>Can you do an <code>if</code> statement within the <code>switch</code> statement, or is there a better way to do it?</p>