Home

How to change IP Address using Set-NetIPAddress

%3CLINGO-SUB%20id%3D%22lingo-sub-289125%22%20slang%3D%22en-US%22%3EHow%20to%20change%20IP%20Address%20using%20Set-NetIPAddress%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-289125%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWondering%20how%20to%20use%20cmdlet%20Set-NetIPAddress%20to%20change%20the%20current%20config.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20Don't%20want%20to%20ADD%20new%20IP%20to%20the%20interface%20using%20New-NetIPAddress%20cmdlet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMay%20somebody%20could%20help%20me%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-289125%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eipaddress%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-304761%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20IP%20Address%20using%20Set-NetIPAddress%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-304761%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20have%20you%20tried%20and%20with%20what%20results%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-289298%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20IP%20Address%20using%20Set-NetIPAddress%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-289298%22%20slang%3D%22en-US%22%3E%3CP%3EYou'll%20probably%20need%20to%20use%20Two%20Cmdlets%20to%20modify%20the%20Current%20Configuration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20first%20is%20Get-NetAdapter.%3C%2FP%3E%0A%3CP%3EThis%20will%20display%20all%20Physical%20Adapters%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet-NetAdapter%20-physical%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20display%20all%20Physical%20Adapters%20which%20are%20%22live%22%20(Lan%20Connected)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EGet-NetAdapter%20-physical%3C%2FSPAN%3E%20%7C%20Where-Object%20%7B%20%24_.Status%20-ne%20'Disconnected'%20%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20trick%20is%20figuring%20out%20if%20you%20have%20a%20pile%20of%20cards%20connected%2C%20you'd%20have%20to%20filter%20on%20either%20the%20TEAM%20Description%20or%20the%20LAN%20Adapter%20Description.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEach%20Network%20card%20has%20a%20property%20called%20the%20%22InterfaceIndex%22.%26nbsp%3B%20Once%20you%20know%20which%20card%20you're%20trying%20to%20re-configure%20it's%20a%20matter%20of%20using%20the%20InterfaceIndex%20Property%20with%20the%20Set-NetIPAddress%20Cmdlet%20to%20update%20the%20value%20of%20the%20Network%20Card.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EExample%20-%26nbsp%3B%20Changing%20to%20a%20StaticIP%20address%20of%2010.0.0.5%20with%20a%20subnet%20mask%20of%20255.255.255.0%20(24%20bits)%20on%20Interface%20Index%206%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESet-NetIPAddress%20-InterfaceIndex%206%20-IPAddress%2010.0.0.5%20-PrefixLength%2024%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESean%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
jvjfranca
Visitor

Hi,

 

Wondering how to use cmdlet Set-NetIPAddress to change the current config.

 

I Don't want to ADD new IP to the interface using New-NetIPAddress cmdlet.

 

May somebody could help me?

 

Thanks.

2 Replies

You'll probably need to use Two Cmdlets to modify the Current Configuration.

 

The first is Get-NetAdapter.

This will display all Physical Adapters

 

Get-NetAdapter -physical

 

This will display all Physical Adapters which are "live" (Lan Connected)

 

Get-NetAdapter -physical | Where-Object { $_.Status -ne 'Disconnected' }

 

The trick is figuring out if you have a pile of cards connected, you'd have to filter on either the TEAM Description or the LAN Adapter Description. 

 

Each Network card has a property called the "InterfaceIndex".  Once you know which card you're trying to re-configure it's a matter of using the InterfaceIndex Property with the Set-NetIPAddress Cmdlet to update the value of the Network Card.

 

Example -  Changing to a StaticIP address of 10.0.0.5 with a subnet mask of 255.255.255.0 (24 bits) on Interface Index 6

 

Set-NetIPAddress -InterfaceIndex 6 -IPAddress 10.0.0.5 -PrefixLength 24

 

Sean

 

 

 

What have you tried and with what results?

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies