To capture packets by port on Windows 11 or Windows 10 version 2004 (build 19041) and later, open Windows PowerShell as an administrator, add a port filter with
pktmon filter add, and start a capture with pktmon start --capture. Reproduce the problem once, run pktmon stop, then convert the resulting ETL log to a .pcapng file with pktmon etl2pcap. Pktmon is built into Windows, and neither capture nor conversion requires a restart or a Wireshark installation. Some older Windows 10 builds use a different converter command; check the built-in help before recording.
Prepare the PC and check the available commands
- Open an elevated Windows PowerShell window. On either Windows 10 or Windows 11, open Start, search for Windows PowerShell, choose Run as administrator, and approve the User Account Control prompt if it appears. The commands below use PowerShell variables, so run them in PowerShell rather than Command Prompt. Capture only on a PC and network where you’re authorized to collect traffic.
- Check the Windows version and Pktmon syntax. Run
winverif you don’t know your version, then run:
Look forCode:pktmon help pktmon start help--capturein the start options andetl2pcapin the command list. Microsoft documents Pktmon itself as far back as Windows 10 version 1809, but its presence alone doesn’t mean the build has the capture and conversion commands shown here. Microsoft’s networking team documents PCAPNG support for version 2004. If your build listspcapnginstead ofetl2pcap, see step 8. If it lists neither, don’t count on being able to complete the built-in export on that PC. - Check for an existing session and filters.
Continue when no capture is running. If another capture is active, let its owner finish rather than stopping it. If filters already exist, don’t assume your new one will replace them. Pktmon reports packets matching any one of the configured filters, so an unrelated filter can collect traffic you didn’t intend to record. If the old filters are yours and are no longer needed,Code:pktmon status pktmon filter listpktmon filter removeclears all of them. Otherwise, coordinate with whoever configured them before proceeding.
Set the port filter and record one reproduction
- Add the port and transport protocol, then verify the filter. This example records TCP traffic on port 443. Substitute the actual service port and protocol if you’re diagnosing something else.
Confirm the list showsCode:pktmon filter add Web443 -t TCP -p 443 pktmon filter listWeb443, TCP, and port 443, with no unintended filters. The port can match on either end of a packet, so one filter covers requests to port 443 and replies from it. It does not identify an application: unrelated connections using TCP 443 can match, too. If you know the service’s IP address, narrow the capture by adding-iand that address to the same filter command in place of the example above. Adding an IP-only filter as a second entry would broaden the capture instead. For UDP traffic, use-t UDP; a TCP 443 filter won’t show QUIC traffic on UDP 443. - Create a local folder and start a bounded capture. Use a folder that isn’t shared or synced. The commands below create a new folder under the current account’s local app data and print its path. Keep this PowerShell window open so the path variables remain available for conversion.
Before starting: Close unrelated apps where practical and avoid entering real passwords or opening sensitive records during the capture. The 128-byte limit below reduces how much of each packet is saved, but those bytes can still contain payload data. It is not a headers-only or anonymized capture. Don’t useCode:$captureDir = Join-Path $env:LOCALAPPDATA ("Pktmon-" + (Get-Date -Format 'yyyyMMdd-HHmmss')) New-Item -ItemType Directory -Path $captureDir -ErrorAction Stop | Out-Null $etl = Join-Path $captureDir 'PortCapture.etl' $pcap = Join-Path $captureDir 'PortCapture.pcapng' $captureDir--pkt-size 0for a routine trace: that requests full packets.
Check that the capture is running before reproducing the issue.Code:pktmon start --capture --comp nics --pkt-size 128 --file-name "$etl" --file-size 64 --log-mode circular pktmon status--comp nicslimits collection to network adapters rather than every component in the Windows networking stack. The 64 MB circular ETL log overwrites its oldest events if it fills, so start just before testing and stop promptly afterward. - Reproduce the problem once and check the counters. Perform the failing action on the PC you’re capturing from, and note the time and time zone so you can find it in the trace. For a basic TCP check, you can run the following in a second PowerShell window. Replace
service.examplewith the hostname of a service you’re authorized to test.
Test-NetConnection -ComputerName service.example -Port 443
TcpTestSucceededtells you whether that TCP connection succeeded. It doesn’t test the application login, the HTTPS request, or UDP. Back in the capture window, runpktmon counterswhile the session is still active. Matching traffic in the counters is a useful early check, but it doesn’t prove that the exported file contains the exchange you need. - Stop explicitly and confirm the ETL exists. Do this even if the problem didn’t reproduce. If you closed the original window, reopen an elevated PowerShell window and run the stop and status commands there.
The status should no longer show an active capture, andCode:pktmon stop pktmon status Get-Item -LiteralPath $etlGet-Itemshould showPortCapture.etl. If you reopened PowerShell, use the full ETL path printed in step 5 in place of$etl; the variable won’t carry over to a new window.
Convert the ETL and verify the PCAPNG
- Run the converter after the capture has stopped.
If the installed build listsCode:pktmon etl2pcap "$etl" --out "$pcap" Get-Item -LiteralPath $pcap | Select-Object FullName, Lengthpcapnginstead, runpktmon pcapng helpand use the older form below if its help shows the-ooutput option:
pktmon pcapng "$etl" -o "$pcap"
Keep the original ETL private if you still need to investigate packet drops. Microsoft documents that the standard PCAPNG export excludes packets logged as drops by default and doesn’t preserve Pktmon’s drop reasons or the packet’s path through the Windows networking stack. - Open the file and check the actual conversation. In Wireshark, use File > Open and select
PortCapture.pcapng. Apply the display filtertcp.port == 443, orudp.port == 443if you captured UDP. Use your own port if different. Check that the packet list contains the expected endpoints and that the timestamps cover the action you recorded. A nonzero file size only confirms that a file was written. For a fresh TCP attempt, an outbound SYN without a visible reply is still useful evidence, but it doesn’t tell you where a reply was lost or why it never arrived.
Review the capture before sharing it
- Prefer a written summary if it answers the support question. The time, port, and whether you observed an outbound connection attempt or a reply may be enough. Treat both the ETL and PCAPNG as sensitive: even a short capture can expose IP or MAC addresses, hostnames, and parts of unencrypted requests. Conversion doesn’t remove that information.
- Export a smaller copy if the recipient needs packets. In Wireshark, narrow the display to the relevant connection, then choose File > Export Specified Packets…. Under Packet Range, confirm Displayed, not Captured, and save a new PCAPNG with a different name. A display filter by itself only hides packets in the current view. Reopen the new file, clear any display filter, and review what was actually exported, including packet details and bytes. Exporting fewer packets doesn’t redact the packets you kept.
- Use an approved private channel. Don’t attach the original capture to a public forum thread or upload it to an online converter. If the remaining packets still contain data you can’t share, send a redacted written summary or repeat the capture with test data. Retain or delete the original and any exported copies according to your organization’s retention policy.
Troubleshoot an empty or incomplete trace and clean up
- No matching packets: Check
pktmon filter listfor the actual port and protocol, and confirm you generated traffic after the capture started. A browser may use UDP 443 where a TCP-only capture expects TCP 443. A local-only connection or traffic observed elsewhere in a VPN or virtual networking stack may not appear in a NIC-only trace. If the protocol and port are correct, try another short, filtered capture with--comp all. Microsoft notes that Pktmon can record the same packet at multiple stack components, so don’t assume repeated entries are retransmissions. - The beginning of the exchange is missing: The circular log may have wrapped before you stopped it. Start closer to the test and stop immediately afterward. If Wireshark shows that individual packets were cut short instead, that’s a separate limit:
--pkt-size 128controls bytes per packet, while--file-size 64controls the size of the ETL log. - The ETL exists but the PCAPNG doesn’t: Confirm the capture has stopped, the input is the Pktmon-generated ETL from this run, and the output folder is writable. If you opened a new PowerShell window, use quoted full paths for both files rather than unset variables. Check
pktmon helpfor the converter name on that build. - You need a Windows-side drop reason: Keep the ETL and inspect a local text conversion with
pktmon etl2txt "$etl"on builds that list that command. If the NIC-only capture doesn’t show the relevant stack component, repeat with the same narrow filter and--comp all. Don’t disable the firewall or VPN just to make packets appear in the export.
When you’re finished, run pktmon status to confirm your session is stopped. If the listed filters are all from this procedure, run pktmon filter remove, then pktmon filter list to confirm the list is empty. Removing filters does not delete either capture file, and no reboot or network reset is needed.