Manage your Windows Cloud Servers via the Command Line Interface

2020-01-01 By Aaron 4133 Views windows command
47 reviews

Windows comes packed with several useful network utilities. These programs can get you critical information about your network connection and help diagnose problems. This tutorial describes some useful Networking utility commands and their usage.


windowscommand


1. Ping

Ping stands for Packet Internet Groper and this utility is used to verify IP level connectivity between different hosts. It actually sends ICMP requests messages.


ping <hostname>
OR
ping <ip address>

windowscommand13


Useful Options:

COMMAND EXPLANATION
-a This resolves address to the hostname
-n This denotes number of echo requests to send
-i Denotes Time to Live
-r The option record routes for counting hops
-t For continuous ping


2) ipconfig

This command utility is to verify the network adapter configuration. The configuration includes IP address, subnet mask and default gateway. It is most commonly used by network administrators to verify the adapter settings and to check the configuration.


Command syntax:

ipconfig [/<option-name>]


The output of simple ipconfig command is as below:

windowscommand20


Output of ipconfig /all:

windowscommand21


Useful options:

COMMAND EXPLANATION
No options Just briefly show the configured network adapter’s information
/all Show detailed information of network adapter that includes IP address, subnet mask, gateway, DNS, DHCP, MAC address
/release Release the IP address of network adapter
/renew Renew the IP address of the network adapter, mainly used when relying on DHCP server
/flushdns Clear the resolver DNS cache


3. hostname

This command utility is used to determine the hostname of the machine.

hostname

windowscommand23


4) getmac

This utility is usually used for troubleshooting purposes such as network issues to retrieve the MAC address of the particular machine. Each network card in a server has its own MAC address.

getmac


The below example shows the getmac command with verbose option and it returns the MAC address of the interface:

windowscommand22


Useful options:

COMMAND EXPLANATION
/s Specify the remote host to connect to. Either IP address or hostname
/p Specify the password for the given user context
/v Describe verbose output will be displayed


5) arp

ARP- stands for Address Resolution Protocol. The servers maintain an ARP table which is a list of IP addresses mapped against MAC addresses. The table serves as a cache of those hosts to which the server has communicated recently in the local network. This utility is used by network administrators to identify any duplicate IP assigned in the network and invalid entries in the ARP table.

arp -a


Useful options:

COMMAND EXPLANATION
-a Display the ARP table for a particular IP address or all the entries of the ARP cache or table
-d Delete an entry from the ARP table. To delete use arp –d < IP address >


6) nslookup

Network administrators use the utility nslookup for troubleshooting DNS-related issues.

nslookup can be used in both interactive and non-interactive modes. To look up more than one piece of data, the interactive mode is to be used. Non-interactive mode nslookup is used mostly when it requires to lookup a single piece of data. For both cases, parameters are to be passed along with the command.


The application example of nslookup is given below.

Simply nslookup command returns the default server DNS and its primary DNS server:

nslookup

windowscommand24


nslookup can also be used to lookup any specific type of record type for a domain name by using keyword -type=, where record_type may be A, CNAME, MX, PTR, NS or any other records.

nslookup -type=<record_type> <domain_name>


To find mail servers for a domain:

nslookup -querytype=mx <domain_name>

windowscommand16


To find all the available DNS records of a domain:

nslookup -type=any <domain_name>


7) nbtstat

This utility uses the NetBIOS name for address resolution. NetBIOS name table will be maintained on the Cache for both local sides as well as remote hosts. The table resolves NetBIOS names to IP addresses. This command is specially used by Windows Administrators.

nbtstat <option>


The below example shows the nbtstat -n option which displays the registered NetBIOS name of the host:

windowscommand26


Useful options:

COMMAND EXPLANATION
-a Return the NetBIOS name table and MAC address of the address card for the Host server name.
-c List out the contents of NetBIOS name cache
-S List the current NetBIOS sessions
-n Display the registered names locally by NetBIOS applications


8) netstat

netstat (Network Statistics) utility is used to monitor and troubleshoot network issues. It can be used to list active network connections and their listening ports. Protocol level statistics can be viewed with the utility, i.e., you would be able to view the statistics of the protocols involved such as TCP/UDP, IPV4/IPV6, ports and incoming/outgoing, etc.

netstat <options>


Simple netstat output:

windowscommand25


The output of netstat with options:

netstat –a -n

windowscommand27

Useful options:

COMMAND EXPLANATION
-a Display all active and inactive connections
-b List all the executables associated with each connection
-e Show the statistics of network interface
-f Show FQDN(Fully Qualified Domain Names) along with the connections for foreign addresses
-n Display addresses and port numbers in numerical form
-o Show all active TCP connections
-s Show network statistics for all available protocols
-r Show the current network routing table that lists all routes to destinations and metrics. For both IPV4 and IPV6


9) Taskkill

This utility is used to kill the running tasks. The command has got options to kill a task/process by using the process id or Imagename.


To list all the processes in the command line:

tasklist


The below is the sample output of the tasklist command:

windowscommand30

From the above output, the process id shall be obtained, which can be used in executing the taskkill command.


The below is the syntax to kill a particular task by using the taskkill command:

taskkill /PID <option>


The below example kills/terminates the process with ID 6064 and the output confirms once the process has been killed:

windowscommand29

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.