adien / set_static.ps1
0 likes
0 forks
1 files
Last active
| 1 | $IP = "10.10.10.10" |
| 2 | $MaskBits = 24 # This means subnet mask = 255.255.255.0 |
| 3 | $Gateway = "10.10.10.1" |
| 4 | $Dns = "10.10.10.100" |
| 5 | $IPType = "IPv4" |
| 6 | # Retrieve the network adapter that you want to configure |
| 7 | $adapter = Get-NetAdapter | ? {$_.Status -eq "up"} |
| 8 | # Remove any existing IP, gateway from our ipv4 adapter |
| 9 | If (($adapter | Get-NetIPConfiguration).IPv4Address.IPAddress) { |
| 10 | $adapter | Remove-NetIPAddress -AddressFamily $IPType -Confirm:$false |
Newer
Older