โšกPowerShellWiki
โ† All cheat sheets
๐ŸŒ

Networking

Test connectivity, make web requests, and inspect network config.

Connectivity tests

Ping a host

Modern replacement for ping.

Test-Connection -TargetName google.com -Count 4

Test a specific TCP port

Check whether a port is open and reachable.

Test-NetConnection -ComputerName example.com -Port 443

Resolve a DNS name

Look up the IP addresses for a hostname.

Resolve-DnsName -Name example.com

Web requests and APIs

Download a file

Fetch a file from a URL to disk.

Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile ".\file.zip"

Call a REST API (JSON)

Get JSON and auto-parse it into objects.

Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/PowerShell"

POST JSON to an API

Send a JSON body with headers.

$body = @{ name = "demo" } | ConvertTo-Json
Invoke-RestMethod -Uri "https://httpbin.org/post" -Method Post -Body $body -ContentType "application/json"

Interface and IP configuration

Show network adapters

List all network interfaces and their status.

Get-NetAdapter

Show IP addresses

List configured IPv4 addresses.

Get-NetIPAddress -AddressFamily IPv4

Show active TCP connections

List established connections and owning process.

Get-NetTCPConnection -State Established

Related cheat sheets