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
ipconfig /allshows the full configuration, including MAC address and DNS servers.ipconfig /releasefollowed by/renewgets a new DHCP lease.ipconfig /flushdnsclears 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.
How it works
Network testing commands
| Command | Purpose |
|---|---|
ipconfig | Shows Internet Protocol (IP) address, subnet mask and default gateway |
ipconfig /all | Adds the Media Access Control (MAC) address, Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) server details |
ipconfig /release and /renew | Drop the DHCP lease and request a new one |
ipconfig /flushdns | Clears the local DNS resolver cache |
ping | Tests whether a host answers and how fast |
tracert | Lists the routers (hops) on the path to a target |
pathping | Combines ping and tracert, with loss figures per hop |
nslookup | Queries DNS for the address that matches a name |
netstat | Shows connections and listening ports |
hostname | Prints 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
| Command | Purpose |
|---|---|
gpupdate | Refreshes Group Policy settings now |
gpupdate /force | Reapplies all policies, not only the changed ones |
gpresult /r | Shows 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.
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 /allshows the full configuration, including MAC address and DNS servers.ipconfig /releasefollowed by/renewgets a new DHCP lease.ipconfig /flushdnsclears the DNS cache.ping 127.0.0.1tests the local network software.tracertshows each hop, andpathpingadds packet loss statistics per hop.nslookuptests name resolution, and a second argument chooses the DNS server.netstat -anolists connections with their process IDs.net usemaps drives, andnet usermanages accounts.gpupdate /forcereapplies policy, andgpresult /rshows what applied.shutdown /r /t 0restarts 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 innetstat -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.