$NewIP = ‘192.168.1.26’
$NewGateway = ‘192.168.1.1’
$NewDNS = ‘208.67.222.222 ‘
$Prefix = 24
$MyAdapter = Get-NetAdapter |
Where-Object Status -eq ‘Up’ |
Out-GridView -Title ‘Select Adapter to Configure’ -OutputMode Single
$index = $MyAdapter.InterfaceIndex
New-NetIPAddress -InterfaceIndex $index -IPAddress $NewIP -DefaultGateway $NewGateway -PrefixLength $Prefix -AddressFamily IPv4 -WhatIf
Set-DNSClientServerAddress –InterfaceIndex $index –ServerAddresses $NewDNS -whatIf