A better way to add and remove Windows hosts file entries
This script adds entries to your local hosts file idempotently and can take three parameters: -Hostname (this is the hostname you want to add) -DesiredIP (this is the IP address you want to associate with that hostname) -CheckHostnameOnly (if this is false (which it is by default) then it checks the combination of hostname and
A hosts file is a local plain text file that maps your server or hostnames to Internet Protocol (IP) addresses.Every time Windows 10 connects over a network using a hostname, it’ll refer to the hosts file
If Windows finds an entry in this file, then it’ll contact the specified server.
Reset HOSTS File Back To Default on Windows (2022 Guide)
Method to reset Windows 10 hosts file
Press Start at the bottom-left corner of the screen and search for Notepad; Right-click on the application and pick Run as Administrator option; Press Yes on the UAC screen; Navigate to File > Open; Enter C:\Windows\System32\drivers\etc;