< Back

Set-IPAddress

Mon Jan 13, 2020 12:52 am

NAME Set-IPAddress



SYNOPSIS

Changes your current Ip Address





SYNTAX

Set-IPAddress [-NetIfIndex] <Int32> [-NewIP] <String> [[-SubnetLength] <String>] [-AddrFamily <String>]

[-GatewayIP <String>] [-DNSIPs <String[]>] [<CommonParameters>]





DESCRIPTION

The cmdlet changes your ip address to new ip given without clicks on gui or need of removeving NetIppAddress





PARAMETERS

-NetIfIndex <Int32>

Index number of the Adapter you want to change the Ip of



Required? true

Position? 1

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-NewIP <String>

Your New Ip Address. For Now, This cmdlet supports only ipv4



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SubnetLength <String>

Subnet Prefix Length for your new IP. (e.g. 24 for 255.255.255.0, 23 for 255.255.254.0, 22 for 255.255.252.0,

...)

Default value is your current Subnet prefix length



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AddrFamily <String>

Ip Address Family. Either IPv4 or IPv6

Default value is IPv4



Required? false

Position? named

Default value IPv4

Accept pipeline input? false

Accept wildcard characters? false



-GatewayIP <String>

Sets gateway address



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DNSIPs <String[]>

Sets DNS Server addresses



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-IPAddress -NetIfIndex 12 -NewIP 10.1.10.1













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-IPAddress -NetIfIndex 12 -NewIP 10.1.10.1 -SubnetLength 24 -AddrFamily IPv4













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-IPAddress 12 10.1.10.11













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Set-IPAddress 12 10.1.10.11 24













-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Set-IPAddress -NetIfIndex 12 -NewIP 10.1.10.1 -SubnetLength 24 -GatewayIP $null -DNSIPs $null













-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Set-IPAddress -NetIfIndex 10 -NewIP 192.168.1.25 -SubnetLength 23 -GatewayIP 192.168.1.1 -DNSIPs

192.168.1.2,192.168.1.3















RELATED LINKS