Goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters
Create the following key or change its value
KeyName: DisabledComponents
Type: REG_DWORD
Value: 255 (Decimal)
A library for every System Administrator, whether it be Windows or Linux.
Goto HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters
Create the following key or change its value
KeyName: DisabledComponents
Type: REG_DWORD
Value: 255 (Decimal)
Set-DNSClientServerAddress –InterfaceIndex <InterfaceIndex as UInt32> -ServerAddresses <Comma separated list of IP Address as String>or
Set-DNSClientServerAddress -InterfaceAlias <InterfaceAlias as String> -ServerAddresses <Comma separated list of IP Address as String>Before Setting DNS After Setting DNS Removing DNS server First find the InterfaceAlias or InterfaceIndex using the “Get-NetIPInterface” of the desired interface. Now use the following command to reset the DNS server IP address
Set-DnsClientServerAddress –InterfaceIndex <InterfaceIndex as UInt32> -ResetServerAddresses
or
Set-DnsClientServerAddress -InterfaceAlias <InterfaceAlias as String> –ResetServerAddressesAfter resetting DNS Removing IP Address First find the InterfaceAlias or InterfaceIndex using the “Get-NetIPInterface” of the desired interface. Now use the following command to remove just the IP address from the interface
Remove-NetIPAddress –InterfaceIndex <InterfaceIndex as UInt32>or
Remove-NetIPAddress -InterfaceAlias <InterfaceAlias as String>
Remove-NetIPAddress –InterfaceIndex <InterfaceIndex as UInt32> -IPAddress <IPAddress as String> -DefaultGateway <DefaultGateway as String> [-Confirm:$false]or
Remove-NetIPAddress -InterfaceAlias <InterfaceAlias as String> -IPAddress <IPAddress as String> -DefaultGateway <DefaultGateway as String> [-Confirm:$false]
Get-DNSClientCache
Clear-DNSClientCache
Get-NetIPInterfaceThis will list all the Network cards with their InterfaceIndex, Interface lias, AddressFamily, NlMtu in Bytes, InterfaceMetric, DHCP status, ConnectionState and PolicyStore in that order. To view more details about a particular network card use the following command
Get-NetIPInterface –InterfaceAlias <InterfaceAlias as String> or Get-NetIPInterface –InterfaceIndex <InterfaceIndex as UInt32>Another command that you can use for this purpose is the following one
Get-NetIPConfigurationIssuing this will command will give you the details of the IP Network Interfaces as shown below
Get-NetIPConfiguration –InterfaceAlias <InterfaceAlias as String>[Note: You can use any of these commands to find the InterfaceAlias or InterfaceIndex for the commands below and for commands in Part 2 of this post]
or
Get-NetIPConfiguration –InterfaceIndex <InterfaceIndex as UInt32>
Get-NetAdapterThis will list the Name, InterfaceDescriptuion, InterfaceIndex, Status, MAC Address and Speed of all the visible network adapters in the system. If you want to view the status of the hidden adapters also, use the following command
Get-NetAdapter –IncludeHiddenTo disable a network adapter First find the InterfaceAlias using the “Get-NetIPInterface” command or InterfaceDescription using “Get-NetAdapter” of the desired interface. Now use the following command
Disable-NetAdapter -Name <InterfaceAlias>
or
Disable-NetAdapter -InterfaceDescription < InterfaceDescription>To disable a network adapter without asking for confirmation, use the following command
Disable-NetAdapter -Name <InterfaceAlias> -Confirm:$false
or
Disable-NetAdapter -InterfaceDescription < InterfaceDescription> -Confirm:$falseTo enable a network adapter First find the InterfaceAlias using the “Get-NetIPInterface” command or InterfaceDescription using “Get-NetAdapter” of the desired interface. Now use the following command
Enable-NetAdapter -Name <InterfaceAlias>
or
Enable-NetAdapter -InterfaceDescription < InterfaceDescription>To disable IPV6 in a network adapter First find the InterfaceAlias using the “Get-NetIPInterface” command or InterfaceDescription using “Get-NetAdapter” of the desired interface. Now use the following command
Set-NetAdapterBinding -Name <InterfaceAlias> -ComponentID ms_tcpip6 -Enabled $false
or
Set-NetAdapterBinding -InterfaceDescription < InterfaceDescription> -ComponentID ms_tcpip6 -Enabled $falseBefore Disabling IPv6 After Disabling IPv6 Setting IPv4 address to a network card First find the InterfaceAlias or InterfaceIndex using the “Get-NetIPInterface” of the desired interface. Now to set the IP address, Subnet mask and default gateway for the desired network card please use any of the following command.
New-NetIPAddress –InterfaceIndex <InterfaceIndex as UInt32> –IPAddress <IPAddress as String> –PrefixLength < PrefixLength as Byte> –DefaultGateway < DefaultGateway as String>
or
New-NetIPAddress –InterfaceAlias <InterfaceAlias as String> –IPAddress <IPAddress as String> –PrefixLength < PrefixLength as Byte> –DefaultGateway < DefaultGateway as String>