PowerShell Tools
CLI Tools
Note
Several commands that are helpful tools in PowerShell can be used on other operating systems.
net user
Sample Output:
- Create a new user Try:
- Delete User You Created
net use
The net use command is used to connect to, manage, or disconnect from shared network resources (such as shared drives or printers). It allows you to map network drives, view active connections, or remove them.
Sample Output:
hostname
Displays the name of the host system you are on
Sample Output:
Fun Fact:
On Linux hostname -i
- Displays the IP address of the system (for systems with a configured DNS).
However when run on PowerShell you will get the following error:
If you want to find your IP address in Windows PowerShell you need to use ipconfig
or Get-NetIPAddress
.
Note
For further information on the commands below, talk to your networking person! Don’t bully me.
ipconfig
The command ipconfig
run alone displays your IP address.
or
Example Output:
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
Test connectivity between your computer and a remote system. Ping can also measure latency, the time it takes for packets to travel to the destination and back in milliseconds.
Ping can help you troubleshoot. If the ping command fails, it can indicate an issue with network configuration or routing. (It may also be the target system is down or blocking ICMP traffic, but that’s a conversation for another time.)
- Syntax
ping [hostname or IP address]
Example:
Sample Output:
Pinging 8.8.8.8 with 32 bytes of data:
I pinged 8.8.8.8 (Google’s public DNS server and a 32 bytes of data indicates the size of the packet being sent in each ping request.)
Reply from the server:
bytes=32 The size of the data packet sent and received is 32 bytes.
time=37ms The round-trip time (how long it took the packet to travel to 8.8.8.8 and back) is 37 milliseconds.
TTL=118 Time to Live (TTL) indicates how many “hops” the packet can pass through (routers) before it is discarded. (Each router decreases this value by 1.)
Request timed out This means one of the packets did not receive a reply. Possible causes: Temporary network congestion, packet loss or the server or a router along the path might have temporarily dropped the packet.
netstat
netstat (network statistics) displays network connections, routing tables, interface stat
Common Options in Windows:
Option | Description |
---|---|
-a | Displays all connections and listening ports. |
-n | Displays addresses and port numbers in numerical form (i.e., no DNS lookup). |
-o | Displays the process ID (PID) associated with each connection. |
-b | Shows the executable involved in creating each connection (requires admin privileges). |
-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, the netstat tool is part of the net-tools package. Although this package is deprecated in favor of ss (socket statistics), people are set in their ways and still use netstat.
nslookup
nslookup (nameserver lookup)
nslookup [hostname] [server]
Try:
Sample Output:
tracecert
Network diagnostic tool used to trace the path that packets take from your computer to a destination (such as a domain or IP address) and to measure the delay between hops along the way.
tracert [hostname or IP address]
Try
Sample Output:
chkdisk
format `