Several commands that are helpful tools in PowerShell can be used on other operating systems.
net user
Manage local user accounts.
net user Sample Output:
User accounts for \\COMPUTER-NAME
-------------------------------------------------------------------------------
Administrator Guest Student Create a new user:
net user newuser /add Delete a user:
net user newuser /delete net use
Connect to, manage, or disconnect from shared network resources such as shared drives or printers. Used to map network drives, view active connections, or remove them.
net use Sample Output:
New connections will not be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK X: \\Server\SharedFolder Microsoft Windows Network
OK Y: \\Server\Printer Microsoft Windows Network hostname
Displays the name of the host system you are on.
hostname Sample Output:
BestHostNameEver Fun Fact: On Linux, hostname -i displays the IP address of the
system. Run the same flag in PowerShell and you'll get this instead:
PS C:\Users\ellma\Documents> hostname -i
sethostname: Use the Network Control Panel Applet to set hostname.
hostname -s is not supported.
To find your IP address in PowerShell use ipconfig or
Get-NetIPAddress instead.
ipconfig
For further information on the commands below, talk to your networking person. Don't bully me.
Displays your IP address and network configuration.
ipconfig or
Get-NetIPAddress Example Output:
Windows IP Configuration
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : yourdomain.com
Link-local IPv6 Address . . . . . : fe80::d4a5:2cfa:e3b5:cf2d%12
IPv4 Address. . . . . . . . . . . : 192.168.1.5
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::d4a5:2cfa:e3b5:cf2d%15
IPv4 Address. . . . . . . . . . . : 192.168.1.10
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Tunnel adapter Teredo Tunneling Pseudo-Interface:
Connection-specific DNS Suffix . :
IPv6 Address. . . . . . . . . . . : 2001:0:3487:1200:38b7:e0aa:9f9b:f288
Link-local IPv6 Address . . . . . : fe80::38b7:e0aa:9f9b:f288%3
Default Gateway . . . . . . . . . :
Tunnel adapter isatap.{D94BB44D-CA8C-4DF7-82C9-C52F897B56AC}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : | Option | Description |
|---|---|
ipconfig /all | Displays full detailed network configuration for all interfaces. |
ipconfig /release | Releases the current DHCP-assigned IP addresses for all or specific adapters. |
ipconfig /renew | Renews DHCP-assigned IP addresses for all or specific adapters. |
ipconfig /flushdns | Clears the DNS resolver cache. |
ipconfig /registerdns | Refreshes and registers DNS names with the DNS server. |
ipconfig /displaydns | Shows the current DNS resolver cache. |
ipconfig /allcompartments | Displays all compartments for network interfaces. |
ping
Tests connectivity between your computer and a remote system, and measures latency — the round-trip time for packets to travel to the destination and back in milliseconds.
If ping fails it can indicate a network configuration or routing issue.
(It may also mean the target is down or blocking ICMP traffic — a conversation for another time.)
ping [hostname or IP address] Example:
ping 8.8.8.8 Sample Output:
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=37ms TTL=118
Request timed out.
Reply from 8.8.8.8: bytes=32 time=37ms TTL=118
Reply from 8.8.8.8: bytes=32 time=46ms TTL=118
Ping statistics for 8.8.8.8:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 37ms, Maximum = 46ms, Average = 40ms Reading the output:
- bytes=32 — the size of the data packet sent and received.
- time=37ms — the round-trip time to reach
8.8.8.8and back. - TTL=118 — Time to Live, the number of router hops the packet can pass through before being discarded. Each router decrements this by 1.
- Request timed out — a packet received no reply. Possible causes: temporary network congestion, packet loss, or a router along the path dropped the packet.
netstat
Displays network connections, routing tables, and interface statistics.
netstat | Option | Description |
|---|---|
-a | Displays all connections and listening ports. |
-n | Displays addresses and port numbers in numerical form (no DNS lookup). |
-o | Displays the process ID (PID) associated with each connection. |
-b | Shows the executable involved in creating each connection (requires admin). |
-r | Displays the routing table. |
-e | Displays Ethernet statistics (packets sent/received, errors). |
-p [proto] | Shows connections for a specific protocol (e.g., TCP, UDP). |
-s | Displays statistics for each protocol (e.g., TCP, UDP, ICMP). |
-f | Displays the fully qualified domain name (FQDN) for foreign addresses. |
Fun Fact: On modern Linux distros, netstat is part of the
net-tools package. That package is deprecated in favor of ss
(socket statistics), but old habits die hard.
nslookup
Nameserver lookup — queries DNS to resolve a hostname to an IP address.
nslookup [hostname] [server] Example:
nslookup google.com Sample Output:
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: google.com
Address: 142.250.190.14 tracert
Traces the path packets take from your computer to a destination and measures the delay at each hop along the way.
tracert [hostname or IP address] Example:
tracert google.com Sample Output:
Tracing route to google.com [142.250.190.14]
over a maximum of 30 hops:
1 1 ms 1 ms 1 ms 192.168.1.1
2 10 ms 8 ms 11 ms 10.0.0.1
3 15 ms 14 ms 15 ms 198.51.100.1
4 22 ms 20 ms 21 ms 203.0.113.5
5 30 ms 28 ms 27 ms 142.250.190.14
Trace complete.