I am looking at to see if I can create powershell script to update the contents in the host file.
Anybody know if there are any examples that manipulate the host file u
All of these answers are pretty elaborate. This is all you need to add a hosts file entry:
Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tlocalhost" -Force
IP address and hostname are separated by `t which is the powershell notation for a tab character.