I have a .csv file that uses 2 columns that both have headings: Teacher,Channel
Below the teacher column sits the teachers username and below the Channel column sits the teachers assigned Channel.
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.
So far I have this:
$strCSV = "\\SEVERNAME\SHARE\FOLDER"
$strCurrentUser = Get-WmiObject -Class Win32_ComputerSystem
$strChannel = Import-Csv $strCSV\teachers.csv | where {$_.Teacher -eq $strCurrentUser.UserName.TrimStart("DOMAIN\")} | % channel
It's not much, but I am really new to Powershell, so any help would be amazing please.