Get-NetIPAddress
Get-NetIPConfiguration
New-NetIPAddress -InterfaceIndex “IndexNo” -IPAddress xxx.xxx.xxx.xxx -PrefixLength 24 -DefaultGateway xxx.xxx.xxx.xxx
Suppose we have the following required configurations:
- IndexNo: 8
- IPAddress: 192.168.1.38
- PrefixLength: 24
- DefaultGateway : 192.168.1.1
Replace the command parameters with your own addresses.
Note that the prefix length specifies the subnet mask of IP address.
Set-DnsClientServerAddress -InterfaceIndex "IndexNo" -ServerAddresses "xxx.xxx.xxx.xxx , xxx.xxx.xxx.xxx"
Replace xxx.xxx.xxx.xxx with your required primary and secondary DNS server addresses.
If you want to remove the IP address with PowerShell, use the following command
Remove-NetIPAddress -IPAddress "xxx.xxx.xxx.xxx"
- 원본링크
How to Change Your IP Address in Windows Using PowerShell (faqforge.com)