Capture Videos from Hyper-V VMs using PowerShell

In a recent project I was deploying hundreds of VMs across a large set of Hyper-V Hosts, and I needed to capture the screen output of each VM for documentation and troubleshooting purposes.

Long story short, here is a PowerShell script that will capture still images from the screen of each Hyper-V VM according to the framerate and duration you define (I captured 5 images per second per VM for an hour). The script will then use FFMPEG to create videos, one video per VM, based on the still images.

Script on GitHub:


Below are the parameters you want to customize. You need to a download a Windows binary of FFMPEG as well. I used the full FFMPEG release from Gyan Dashi: Builds – CODEX FFMPEG @

$ImageType = "png"
$ImagePath = "E:\temp\vmimages"
$VideoPath = "E:\temp\vmvideos"
$LocalImagePath = "C:\temp\vmimages"
$ffmpegEXE = "E:\Setup\ffmpeg\ffmpeg.exe"
$RunTimeInSeconds = 2700
$CaptureFrameRate = 2 
$ResultingVideoFrameRate = 10
Folder with one video per VM
Still image
About the author

Johan Arwidmark

5 3 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
Robert Rathbun
Robert Rathbun
2 months ago

You could also leverage psr.exe which is natively built into the windows operating system. Not only is it part of Windows, but it is also exclusively designed for exactly this purpose and many people aren't even aware it exists.

Search PSR and enter, set max number of captures and start recording.