You can use the Netsh.exe tool to perform the following tasks:
- Configure interfaces
- Configure routing protocols
- Configure filters
- Configure routes
- Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service
- Display the configuration of a currently running router on any computer
- Use the scripting feature to run a collection of commands in batch mode against a specified router
To switch the specified adapter from a static address to DHCP, type the following command:
NOTE: Typing this command changes the interface named “Local Area Connection” to DHCP.
To display all of the adapters in the computer with their current IP addresses to determine the correct adapter name, type the following command:
To change to a static address, type the following command:
NOTE: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric. The following example changes the interface “Local Area Connection” to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:
Changing DNS:
First, the network name is likely “Ethernet”, not “Local Area Connection”. To find out the name you can do this:
netsh interface show interface
Which will show the name under the “Interface Name” column (shown here in bold):
Admin State State Type Interface Name ------------------------------------------------------------------------- Enabled Connected Dedicated Ethernet
Now you can change the primary dns (index=1), assuming that your interface is static (not using dhcp):
netsh interface ipv4 add dnsserver "Ethernet" address=192.168.x.x index=1
netdom join <ComputerName> /domain:<DomainName> /userd:<UserName> /passwordd:*****
Where:
ComputerName is the name of the server that is running the Server Core installation.
DomainName is the name of the domain to join.
UserName is a domain user account with permission to join the domain.
NOTE: Ensure you have the primary DNS server set to your Domain Controller
3. When prompted to enter the password, type the password for the domain user account specified by UserName.
4. Restart the computer for the changes to take effect.
C:\Users\administrator> shutdown /r /t 0