I’m attempting to build a PS script to check usernames on two different CSV sheets. One has disabled users, the other has licensed, enabled users. I need to find out if any of the licensed, enabled users appear on the disabled users CSV sheet. I’ve gotten thus far:
You’ll probably have a better time using Import-Csv, rather than Get-Content. That way you wind up with objects and can make use of the -Property parameter of Compare-Object. Since you’re only interested in users that are in both files, you can use the -IncludeEqual and -ExcludeDifferent switches as well. Something along these lines, assuming that “UserName” is a column name in your files: