Networking/Computing Tips/Tricks

Rate this content:
4 of 5 - 2 votes
Thank you for rating this article.

A frequent visitor here will know that we have many articles discussing the netsh command line shell/scripting tool in Windows.  The tool was originally introduced in Win2K.  If you aren't a regular - just click on 'netsh' in the tag cloud to see them all.

This article discusses how you can use the 'netsh trace' function to actually perform a packet capture from the command line in Windows.  Technically this means you do not need a capture tool on a Windows machine other than the OS itself.

To analyze and view the packets, you need a tool, and our favorite is Wireshark, of course!

Here is how to use netsh to accomplish this task.  

[Note: you may need to use Run as Administrator to get your system to work correctly]

We begin by examining the help screen with the following command:

netsh trace start ?

netsh trace1


You can see there are many options.

To do a simple trace/capture we will use the following command:

netsh trace start capture=yes traceFile="c:\netsh_trace.cap"

netsh trace2

The capture will run in the background.

To stop the capture, use the following command:

netsh trace stop

It will take several minutes to close.  Be patient!

netsh trace3

If we go and look at my directory c:\ we see the file was saved as follows:

netsh trace4

And if we try to open either of them in Wireshark, we get the following error:

netsh trace5

So you have to use something like Microsoft Message Analyzer (now retired – see their web page here: ), or the older (now in archive, but still works) Microsoft Network Monitor ( to open the file, and then you will be able to export it so you can analyze in Wireshark.

I hope you find this article and its content helpful.  Comments are welcomed below.  If you would like to see more articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!, and all comments are welcome! 

Add comment


Did you learn something?
Did I save you time? 

Buy me a coffeeBuy me a coffee!

Find by Tag

5G Networks 6LoWLAN 6LoWPAN 802.11 802.11ah 802.11ax 802.11ay 802.11az ACL Addressing Analysis Ansible Architecture ARP Assessment AToM Backup Bandwidth BGP Bibliography Biography Briefings CBRS CellStream Cellular Central Office Cheat Sheet Chrome Cisco Clock Cloud Computer Consulting CPI Data Center Data Networking Decryption DHCPv4 DHCPv6 Display Filter DNS Documentation ECMP EIGRP Ethernet Flipping the Certification Model Follow Me Fragmentation Git GNS3 Google GQUIC Hands-On History Home Network HTTPS ICMP ICMPv6 IEEE 802.11p IEEE 802.15.4 In A Day Internet IOS Classic IoT IPv4 IPv6 L2 Switch L2VPN L3VPN LDP Learning Services Linux LLN Logging LoL M-BGP MAC MAC OSx Macro Microsoft mininet Monitoring Monitor Mode MPLS Multicast Name Resolution Netflow NetMon netsh Networking Network Science nmap Npcap nslookup Online Learning Online School OpenFlow OSPF OSPFv2 OSPFv3 OSX Parrot Passwords pcap pcap-ng PIM Ping Policy Port Mirror POTS POTS to Pipes PPP Profile Profiles Programming Project Management Python QoS QUIC Requirements RFC RIP Routing RPL RSVP SAS SDN Security Self Certification Service Provider Small Business Smartport SONET Span Port SSH SSL Subnetting T-Shark TCP TCP/IP Telco Telecom 101 Telecommunications Telnet Terminal TLS Tools Traceroute Traffic Analysis Traffic Engineering Training Travel Troubleshooting Tunnel Utility Video Virtualbox Virtualization Voice VoIP VXLAN Webex Wi-Fi Wi-Fi 4 Wi-Fi 5 Wi-Fi 6 Wi-Fi 6/6E Windows Wireless Wireless 5G Wireshark Wireshark Tip WLAN ZigBee Zoom

Twitter Feed