Measuring Hyper-V Lab Network Traffic with PowerShell

In a recent project / study, I had the need to measure the individual, as well as combined, inbound and outbound network traffic from a fixed set of VMs. What can I say, PowerShell to the rescue.

The Script

This is a script for Hyper-V, which measures inbound and outbound traffic on a set of virtual machines, both for the individual virtual machines and summarized for the set of virtual machines. Modify line 3-9 to match your environment. The default script setting logs the traffic every 10 seconds.

Download the script: https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Hyper-V/Measure-VMNetworkTraffic.ps1

Note: If the VM is doing multiple reboots. it's more reliable to ask the Hyper-V network adapter performance counters. See this script: https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Hyper-V/Measure-VMNetworkTraffic-Using-Hyper-V-Performance-Counters.ps1

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Ram
Ram
6 years ago

Hi – How can,I do the same for Physical Machine?


>