EDIT: Thank you everyone for the help! The answer was to literally delete the "-" in the script and retype. I copied Set-DNSClientServerAddress "Ethernet" -ServerAddresses ("1.1.1.1","8.8.8.8") from a different stackoverflow answer, and apparantly the dash was the wrong kind of dash.
can anyone help me figure out why this simple script is giving an error, when running the same exact command by copy and pasting it into an existing powershell window works fine?
$confirmation = Read-Host "Change DNS?"
if ($confirmation -eq 'y')
{
Set-DNSClientServerAddress "Ethernet" –ServerAddresses ("1.1.1.1","8.8.8.8")
}
pause
When that is ran manually by copy and pasting into Powershell, it works perfectly.
However, when saving that code into a test.ps1 file, and then right clicking on the file to Run with Powershell, it gives this error: