Monthly Archive


Changing a network address

One task that comes up from time to time is changing the network address on a system. The subnet may be the same but we need to change the last octet of the address

We can find an address using Test-Connection

PS (1) > test-connection server02

Source        Destination     IPV4Address      IPV6Address  Bytes    Time(ms)
------        -----------     -----------      -----------  -----    --------
RSLAPTOP01    server02      {}           32       150

Creating the new address involves changing the last octet of the address

function new-ipaddress {            
param (            
 $ip = Test-Connection -ComputerName $computer -Count 1            
 $octets = $ip.IPV4Address.IPAddressToString -split "\."            
 $octets[3] = $newoctet.ToString()            
 $newaddress = $octets -join "."            


The new address can be used in Win32_NetworkAdapterConfiguration to change the address – but if you change the address you are connecting to you have to wait a long time for your PowerShell session to timeout.

Want to know how to speed up the process – read Chapter 13 of PowerShell and WMI (

Leave a Reply