Created
August 31, 2022 12:19
-
-
Save murpg/541bb15dcb802e04feed366305552b11 to your computer and use it in GitHub Desktop.
This file gathers your local IP and adds an entry to your hosts file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ipV4 = Test-Connection -ComputerName (hostname) -Count 1 | Select -ExpandProperty IPV4Address | |
| $localIP = $ipV4.IPAddressToString | |
| $file = "C:\Windows\System32\drivers\etc\hosts" | |
| $hostfile = Get-Content $file | |
| $hostfile += "$localIP luceesite1.com" | |
| $hostfile += "$localIP luceesite2.com" | |
| Set-Content -Path $file -Value $hostfile -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment