Skip to content

Instantly share code, notes, and snippets.

@LawrenceHwang
Created August 16, 2018 03:58
Show Gist options
  • Save LawrenceHwang/d0e2f03b103e53e28a8c619afabbd96b to your computer and use it in GitHub Desktop.
Save LawrenceHwang/d0e2f03b103e53e28a8c619afabbd96b to your computer and use it in GitHub Desktop.
Renew IP until the node receives a lease with PowerShell
$InterfaceAlias = 'Wi-Fi'
while ((Get-NetIPAddress -InterfaceAlias $InterfaceAlias -AddressFamily IPv4).IPAddress -like '169*')
{
$arg = '/C ipconfig /renew'
Start-Process -FilePath 'cmd.exe' -argumentlist $arg -wait -PassThru
Start-Sleep -Seconds 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment