Skip to content

Instantly share code, notes, and snippets.

@MirzaMerdovic
Created December 5, 2018 14:05
Show Gist options
  • Save MirzaMerdovic/ba78d29636c2a04176737643f29b0db5 to your computer and use it in GitHub Desktop.
Save MirzaMerdovic/ba78d29636c2a04176737643f29b0db5 to your computer and use it in GitHub Desktop.
Powershell script that will resolve you local IP address and persist it to your hosts file.
Install-Module -Name 'Carbon' -AllowClobber
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1}
$ip.ipaddress[0]
Set-HostsEntry -IPAddress $ip.ipaddress[0] -HostName 'home' -Description "Local IP Address"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment