I'm new to powershell and have been practicing to get better so would greatly appreciate all your help.
I have a txt file with just a list of servers that I need to add an account to. However, I need to exclude the server names that does not contain "-" in the servername.
This is what I have right now which obviously doesn't work and I keep getting errors.
$servers = Get-Content "$PSScriptRoot\SQLServers.txt"
foreach ($server in $servers| Where $server -contains "*-*" )