Operating Systems · Topic 8 of 15

Windows Network and System Commands

Use ipconfig, ping, hostname, netstat, nslookup, tracert, pathping, net user, net use, gpupdate, gpresult, shutdown and winver at the Windows prompt.

  • 4 min
In a nutshell
  • ipconfig /all shows the full configuration, including MAC address and DNS servers.
  • ipconfig /release followed by /renew gets a new DHCP lease.
  • ipconfig /flushdns clears the DNS cache.

What it is

Many support tasks start with a command that shows the network state or changes a system setting. These commands run in the Windows Command Prompt, and some need an elevated prompt (Run as administrator). Know what each one reports, because exam questions give a symptom and ask which command to use.

No web pageipconfighas an address?pingis the target reachable?nslookupdoes the name resolve?

How it works

Network testing commands

CommandPurpose
ipconfigShows Internet Protocol (IP) address, subnet mask and default gateway
ipconfig /allAdds the Media Access Control (MAC) address, Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) server details
ipconfig /release and /renewDrop the DHCP lease and request a new one
ipconfig /flushdnsClears the local DNS resolver cache
pingTests whether a host answers and how fast
tracertLists the routers (hops) on the path to a target
pathpingCombines ping and tracert, with loss figures per hop
nslookupQueries DNS for the address that matches a name
netstatShows connections and listening ports
hostnamePrints the name of the computer
ping 192.168.1.1
ping -t 192.168.1.1
ping -n 10 example.com
tracert example.com
pathping example.com
nslookup example.com
nslookup example.com 8.8.8.8
netstat -ano

The -t switch makes ping continue until stopped with Ctrl+C. The -n switch sets how many requests are sent. In nslookup example.com 8.8.8.8, the last value is the DNS server to ask, which helps separate a local DNS fault from a wider one.

In netstat -ano, -a shows all connections and listening ports, -n shows numbers rather than names, and -o adds the process ID (PID) that owns each connection. You can match that PID in Task Manager to find the program involved.

A useful test order is to ping the loopback address 127.0.0.1 (tests the network software on the machine), then the default gateway, then a remote address, then a name. If the address works but the name fails, the fault is DNS.

User and share commands

net user
net user jsmith /add
net user jsmith /delete
net use Z: \\server\share
net use Z: /delete

net user lists local accounts, and the /add and /delete switches create and remove one. Running net user jsmith with no switch shows details about that account.

The net use command maps a network share to a drive letter, and /delete removes the mapping. These commands change the system and need appropriate rights.

whoami
whoami /groups
whoami /priv

The whoami command prints the current account as domain\user. The /groups switch lists the groups the account belongs to, including its integrity level, which is High in an elevated prompt. The /priv switch lists the privileges the account holds.

Use it to check which account a prompt or script is running as and whether it is elevated.

Group Policy commands

CommandPurpose
gpupdateRefreshes Group Policy settings now
gpupdate /forceReapplies all policies, not only the changed ones
gpresult /rShows a summary of the policies applied to the user and computer

Use gpupdate after an administrator changes a policy and you do not want to wait for the normal refresh. Use gpresult to learn which policies actually applied.

System commands

shutdown /s /t 0
shutdown /r /t 60
shutdown /a
winver

The shutdown command uses /s to shut down, /r to restart, /l to sign out, /t to set a delay in seconds and /a to abort a pending shutdown. The winver command opens a small window with the Windows version and build number. It is a quick way to check what a computer runs.

Slow connectionpathpingloss on which hop?Hop with losslikely problem point
Exam tip

To choose between ping and tracert, ask whether you need to know if a host answers (ping) or where along the path the traffic stops (tracert).

What to remember for the exam

  • ipconfig /all shows the full configuration, including MAC address and DNS servers.
  • ipconfig /release followed by /renew gets a new DHCP lease.
  • ipconfig /flushdns clears the DNS cache.
  • ping 127.0.0.1 tests the local network software.
  • tracert shows each hop, and pathping adds packet loss statistics per hop.
  • nslookup tests name resolution, and a second argument chooses the DNS server.
  • netstat -ano lists connections with their process IDs.
  • net use maps drives, and net user manages accounts.
  • gpupdate /force reapplies policy, and gpresult /r shows what applied.
  • shutdown /r /t 0 restarts at once.

Common mistakes

Pinging a name when the problem is DNS. If a ping by address works and a ping by name fails, test DNS with nslookup.

Expecting release and renew to fix a static address. They only affect addresses obtained from DHCP.

Confusing gpupdate with gpresult. One refreshes policy, and the other reports it.

Forgetting that ping may be blocked. A firewall can drop ping while the service still works, so no reply is not proof of an outage.

Check yourself

  • Which command clears the local DNS cache?

    ipconfig /flushdns.

  • Which switch for netstat shows the process ID of each connection?

    -o, as in netstat -ano.

  • Which command maps a shared folder to drive Z?

    net use Z: \\server\share.

Topic 8 of 15 in Operating Systems

Test yourself on Operating Systems

The full CompTIA A+ 220-1202 question bank has 835 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by CompTIA. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.