Networking

Configuration

NetAdapter

https://docs.microsoft.com/en-us/powershell/module/netadapter

Get-NetAdapter -Name * -Physical
Get-NetAdapter -IncludeHidden

NetConnection

https://docs.microsoft.com/en-us/powershell/module/netconnection

Get-NetConnectionProfile -InterfaceAlias "Ethernet1" | Set-NetConnectionProfile -NetworkCategory Public
Set-NetConnectionProfile -InterfaceAlias "Ethernet 2" -NetworkCategory "Public"
Set-NetConnectionProfile -InterfaceAlias "Ethernet 2" -NetworkCategory "Private"

NetTCPIP

https://docs.microsoft.com/en-us/powershell/module/nettcpip

NetIPConfiguration

Get-NetIPConfiguration -Detailed

NetIPInterface

Get-NetIPInterface
Get-NetIPInterface -InterfaceAlias "Ethernet 4" | Format-List
Set-NetIPInterface -InterfaceAlias "Ethernet 2" -Dhcp Disabled
Set-NetIPInterface -InterfaceIndex 21 -Dhcp Disabled

NetIPAddress

Get-NetIPAddress | Format-Table
Set-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168.0.1 -PrefixLength 24
New-NetIPAddress -InterfaceIndex 13 -IPAddress 10.40.30.253 -PrefixLength 24 -DefaultGateway 10.40.30.254
Remove-NetIPAddress -InterfaceIndex 12 -IPAddress 10.40.32.4
Remove-NetIPAddress -InterfaceIndex 12 -DefaultGateway 192.168.53.1

NetRoute

Get-NetRoute | Format-List -Property *
New-NetRoute -DestinationPrefix "10.0.0.0/24" -InterfaceIndex 12 -NextHop 192.168.0.1

DnsClient

https://docs.microsoft.com/en-us/powershell/module/dnsclient

Get-DnsClientServerAddress -InterfaceIndex 21
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("10.0.0.1","10.0.0.2")
Set-DnsClient -InterfaceIndex 12 -ConnectionSpecificSuffix "corp.contoso.com"
Clear-DnsClientCache

Problems

ghost IP configuration after removal of an adapter

  • Open the command prompt as an administrator;
  • Run the command: set devmgr_show_nonpresent_devices=1
  • Start the Device Manager console: devmgmt.msc

In the top menu, click View -> Show hidden devices (in Windows 10 this item is always available, and you don’t need to enable the devmgr_show_nonpresent_devices mode via cmd).

Remove the ghost adapter.

If after removing an unused NIC in the Device Manager you still cannot assign the old IP address to a new adapter, remove the IP configuration of the old NIC from the registry.

The IP settings of your network interfaces are located under the registry key HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces.

This registry keys contains some {Interface GUID} keys. Check them one-by-one until you find the interface, which IPAddress value contains the IP address assigned to the old network interface.

Remember the name of the registry key (it is the identifier of the network adapter). Remove the keys:

  • HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters\{your_NIC_ID}
  • HKLM\SYSTEM\CurrentControlSet\Services\{your_NIC_ID}

Restart your computer and try to assign the old static IP address to a new network adapter.

http://woshub.com/remove-hidden-ghost-network-adapter-windows/

different internal domain than external one

Originally in : http://www.kentoyer.com/2012/08/28/how-to-override-a-single-host-on-your-windows-dns-server/