title: Check if a string exists in a .CSV file and if it doesn't then append it using Powershell
body: <p>I have a .csv file that uses 2 columns that both have headings:
  Teacher,Channel</p>
  
  <p>Below the teacher column sits the teachers username and below the Channel column sits the teachers assigned Channel.</p>
  
  <p>I am trying to get a script working that will check through the .csv for the logged on teachers username and then reply with their channel and if their username doesn't exist then append it and assign it a channel that is 1 number higher than the previous teachers channel. Once the script has added the new username of the logged on user it should use their newly assigned channel.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>$strCSV = "\\SEVERNAME\SHARE\FOLDER"
  $strCurrentUser = Get-WmiObject -Class Win32_ComputerSystem
  $strChannel = Import-Csv $strCSV\teachers.csv | where {$_.Teacher -eq $strCurrentUser.UserName.TrimStart("DOMAIN\")} | % channel
  </code></pre>
  
  <p>It's not much, but I am really new to Powershell, so any help would be amazing please.</p>