Setting up the network adopter by PowerShell

12:41 PM

# Import the NetAdapter module. This step is provided for clarity. It is not needed due to the new module autoloading feature in Windows PowerShell 3.0

Import-Module NetAdapter 

# Retrieve the network adapter that you want to configure.

$netadapter = Get-NetAdapter -Name Ethernet

# Disable DHCP.

$netadapter | Set-NetIPInterface -DHCP Disabled

# Configure the IP address and default gateway.

$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.0.1.100 -PrefixLength 24 -Type Unicast -DefaultGateway 10.0.1.1

# Configure the DNS client server IP addresses.

Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.1.10

You Might Also Like

0 comments

Contact Form

Name

Email *

Message *

Translate

Wikipedia

Search results