- Combine VMConnect/RDP with FFmpeg to record VM window from PowerShell reliably.
- Use Hyper‑V cmdlets (Start/Stop/Checkpoint/Measure‑VM) to prepare and stabilize the session before capturing.
- Transfer binaries and data between host and VMs using SMB, Copy‑VMFile, VHDX, or Enhanced Session.
- Automate VM creation, cleanup, and export to repeat recording scenarios without surprises.

Recording what happens inside a Hyper-V virtual machine from PowerShell is perfectly possible by combining native Hyper-V tools (VMConnect, RDP, Guest Services) with command -line screen capture utilities . This practical guide will show you viable methods for capturing video from a VM's desktop, as well as all the essential PowerShell and Hyper-V tools that will make the task easier: key cmdlets, automation, file transfer, and remote administration.
To give you the complete picture, we've included detailed procedures for moving files between hosts and VMs (essential if you need to transfer installers or binaries like FFmpeg to the VM), essential management cmdlets, and scripts for creating, cloning, or rebuilding VMs. Everything is explained in clear, easy-to-understand Spanish, with practical examples, security recommendations, and best practices.
Requirements and preparation of the environment
Before capturing, it's advisable to prepare the environment: ensure you have an updated version of PowerShell, access to the host and VMs, and the Hyper-V modules installed. Additionally, take steps to prevent notification interruptions during recording. This streamlines the process and reduces errors, so it's worth preparing everything carefully.
What is PowerShell? It's Microsoft's .NET-based automation and scripting framework that combines shell and language. Cmdlets allow you to chain complex actions into scripts (.ps1), schedule them with Task Scheduler, and run them locally or remotely.
How to open PowerShell: On systems with a graphical interface, search for PowerShell and choose “Run as administrator”. Windows Server Core or Hyper‑V Server, type powershell at the symbol of the system to enter PS session. If you use remote access, make sure you have RDP enabled. or configure remoting with WinRM/Enter‑PSSession.
Remote Administration: From your workstation you can install Hyper‑V RSAT tools with Install-WindowsFeature RSAT-Hyper-V-Tools. Then, run cmdlets targeting the host with destination parameters or remote sessions (for example, Enter-PSSession -ComputerName servidor -Credential (Get-Credential)).
Help and discovery: use Update-Help to keep the help up to date and Get-Help <cmdlet> to see syntax and examples. With Get-Command -Module Hyper-V You will list all Hyper‑V cmdlets; if you like to see them in a filterable window, Add | Out-GridView.
Practical methods for capturing video from Hyper‑V VMs using PowerShell
Hyper-V doesn't include a native VM console recorder, but you can combine VMConnect/RDP with a CLI capture tool like FFmpeg. Below are the most reliable scenarios and how to automate them using PowerShell.
1) VMConnect + FFmpeg (capture VM window)
VMConnect opens the VM console in a local window. If you launch VMConnect and point FFmpeg to that window, you get a recording of what's happening inside . Typical steps:
- Start the VM (if not on):
Start-VM -Name "MiVM" -Wait. - Open the console:
vmconnect.exe <NombreHost> "MiVM"(from PowerShell you can runStart-Process vmconnect.exe -ArgumentList "ServidorHV","MiVM"). - Launch FFmpeg capturing the VMConnect window. On Windows, FFmpeg allows gdigrab to capture by window title:
ffmpeg -f gdigrab -framerate 30 -i title="Virtual Machine Connection" -vcodec libx264 -preset veryfast -pix_fmt yuv420p C:\Capturas\MiVM.mp4.
The VMConnect window title may include the name of the VM/host (depending on the version). Adjust the parameter -i title= to the exact text. For audio, add a dshow entry if you have “Stereo Mix” or another source: -f dshow -i audio="Stereo Mix"If you need to convert the resulting MP4 to another container or codec, see how change the format of a video in Windows.
Automation with PowerShell: Create a script that Boot the VM, open VMConnect and run FFmpeg with the appropriate parameters. You can control There of recording with -t 00:10:00 (for example, 10 minutes) or stop FFmpeg sending q to your process.
2) RDP to the VM + FFmpeg (capture the remote session)
If the VM has network and Remote Desktop active, connect with mstsc and record the RDP window with FFmpeg in the same way (gdigrab by title). Advantage: : more stable quality at high resolutions; drawback: Requires network/credentials on the VM.
From PowerShell, you can automate the RDP client with Start-Process mstsc.exe -ArgumentList "/v:10.10.10.50" and then point FFmpeg to the window whose title contains the IP or name of the destination. If you need to map local disks (to save the video inside the VM), set it in the RDP options before connecting.
3) VMConnect in Enhanced Session Mode
“Enhanced Session Mode” allows for better resolutions and local resource usage when connecting with VMConnect, which is very useful for sharp full-screen captures. Activate it on the host: Set-VMHost -EnableEnhancedSessionMode $True, and then connect to the VM with VMConnect. Select the desired resolution; capturing with FFmpeg will work the same as method 1, but with a better visual experience.
This mode also makes it easy to attach drives or redirect host resources, which is great for moving files needed for your tests or for storing recordings.
4) Lightweight alternative: Steps Recorder (not video)
If you don't need continuous video, the older Windows PSR (Steps Recorder) captures screenshots with step annotations. It launches with psr.exe. It does not generate an MP4, but it can be useful for quick documentation without installing anything additional.

Hyper‑V cmdlets that make your life easier when capturing
These commands simplify VM lifecycle management and pre-recording test environment control. They allow you to start, stop, save state, and measure resources before pressing "REC".
Inventory and help: Get-Command -Module Hyper-V list the cmdlets; Get-Help Get-VM explains uses and parameters. You can filter or format it with Format-Table, Format-List u Out-GridView.
List VMs and filter states: Get-VM returns all; for the lit ones, Get-VM | Where-Object { $_.State -eq 'Running' }. If you want the ones that are off, change the filter to 'Off'.
Starting and stopping: Start-VM -Name "MiVM" y Stop-VM -Name "MiVM". To act as a block, Get-VM | Where-Object { $_.State -eq 'Off' } | Start-VM o Get-VM | Where-Object { $_.State -eq 'Running' } | Stop-VM. If he does not answer, Add -Force en Stop-VM.
Clean guest shutdown: Invoke-VMShutdown MiVM -Force try to shut down the OS gracefully. Use it when you want to avoid sudden cuts that can corrupt data.
Save status and checkpoints: Save-VM -Name "MiVM" hibernates the VM; Checkpoint-VM -Name "MiVM" -SnapshotName PreGrabacion create a checkpoint. To delete specific snapshots, Remove-VMSnapshot -VMName "MiVM" -Name NombreParcial*.
Resource metering: activate metering with Enable-VMResourceMetering -VMName "MiVM" and consult with Measure-VM -VMName "MiVM". It helps you to assess the CPU/RAM configuration and measure FPS so that the recording goes smoothly.
Network and VM version: Get-VMNetworkAdapter -All identifies virtual NICs of VMs and the management OS. Update-VMVersion -Name "MiVM" Update the configuration version for new capabilities. Useful if you are going to use Enhanced Session and recent features.
Process utilities: From PowerShell you can start supporting applications like FFmpeg with Start-Process, elevate PowerShell with -Verb RunAs, or stop hung processes with Stop-Process. Combining Process Cmdlets and Hyper‑V allows you to orchestrate the recording from start to finish.
Moving Files Between Hosts and VMs: 7 Methods That Work
To capture, you often need to pass binaries (for example, FFmpeg), ISOs, or scripts between the Hyper-V host and the VMs. These methods cover scenarios with and without networking , with and without a GUI, and with various restrictions.
Method 1: SMB share on the host
Enable the firewall rules for “File and Printer Sharing” on the host and connect from your computer to the host share (for example, \\10.10.10.31\c$\ or map with net use S: \\10.10.10.31\d$). Advantage: Simple and fast in Windows environments. Note: Disable the rule when you are done with netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=No.
Method 2: Single central share
Instead of duplicating ISOs and tools on each host, set up an SMB instance on a server/NAS and grant access to all hosts. This is ideal for an Active Directory domain . If you're transferring to a VM, configure a virtual switch and the appropriate network mode. On Linux, you can use SMB or SSH/SCP.
Method 3: RDP with redirected drives
Enable Remote Desktop on the destination and, when opening MSTSC, redirect to local drives (Local Resources tab > More > Drives). Copy from the mapped drive within the session. Works with both GUI hosts and network-attached VMs.
Method 4: Copy-VMFile (without network)
PowerShell 4+ offers Copy-VMFile to pass files from the host to the VM without relying on the network or firewall. You must activate the Guest Services in the VM: Enable-VMIntegrationService -VMName VM1 -Name 'Guest Service Interface'. Then: Copy-VMFile "VM1" -SourcePath "C:\temp\file.txt" -DestinationPath "C:\Temp\file.txt" -CreateFullPath -FileSource Host.
Method 5: Shared and Mountable VHDX Disk
Create a VHDX on the host (New-VHD -Path C:\Hyper-V\data-temp.vhdx -SizeBytes 8GB -Dynamic), mount it (Mount-VHD), initialize/partition it and format it (NTFS). Copy your files inside, dismount (Dismount-VHD) and attach that VHDX to the VM (Add-VMHardDiskDrive -VMName VM2 -Path C:\Hyper-V\data-temp.vhdx). Inside the VM, assign a letter and copy.
Method 6: VMConnect with Enhanced Session
Activate enhanced mode with Set-VMHost -EnableEnhancedSessionMode $True and when connecting, it redirects local resources as if it were RDP. Allows virtual drag/drop (depending on version) and access to drives, making it trivial to carry capture binaries or output results.
Method 7: ISO image with files
Generate an ISO image with the files you need (read-only from the VM) and mount it on the virtual DVD drive. This is useful for injecting content immutably , such as installers or base tools.
Create, delete, and recreate VMs via script (and prepare them for recording)
When documenting or recording demos, you sometimes need "clean" environments quickly. With PowerShell, you can delete an old VM, recreate it, and have it ready with an ISO and automated response.
Delete a development VM and its VHDs: define $ThisVM = "SQLTestVM", stop the VM (Stop-VM -Name $ThisVM), delete your disks with Get-VMHardDiskDrive -VMName $ThisVM | Remove-Item -Force and then Remove-VM -VMName $ThisVM -Force. Important: Remove-VM It does not delete VHDs, you have to do it separately.
Recreate the VM: use New-VM with the appropriate parameters (name, memory, Generation 2, new VHDX, switch). Connect the OS ISO and it boots. You can add a VFD/response file (unattend) so the installation can be unattended and ready to burn in just a few minutes.
Optional dynamic memory: Set-VMMemory -VMName $ThisVM -DynamicMemoryEnabled $true -MinimumBytes 1GB -StartupBytes 2GB -MaximumBytes 4GB. Optimize resources if you are going to run multiple VMs while recording.
Create a VM with PowerShell step by step
Quick example of creating a Gen2 VM with a 60 GB VHDX and connecting it to a specific switch. You can always adapt paths, memory, and names to suit your needs and thus automate recording labs.
- Create the VM:
New-VM -Name "WSTEST" -MemoryStartupBytes 2GB -Generation 2 -NewVHDPath "D:\hyper-v\virtual hard disks\WSTEST.vhdx" -NewVHDSizeBytes 60GB -SwitchName "ExternalSwitch". - Add DVD with ISO:
Add-VMSCSIController -VMName WSTESTyAdd-VMDvdDrive -VMName WSTEST -ControllerNumber 1 -ControllerLocation 0 -Path D:\ISO\instalador.iso. - Optional fixed disk:
New-VHD -Path "D:\hyper-v\virtual hard disks\wstest.vhdx" -SizeBytes 60GB -FixedyAdd-VMHardDiskDrive -VMName WSTEST -Path "D:\hyper-v\virtual hard disks\wstest.vhdx".
You can also use splatting with a hashtable to make your script more readable: $VM = @{ Name = "VMNAME"; MemoryStartupBytes = 2GB; Generation = 2; NewVHDPath = "C:\Virtual Machines\VMNAME\VMNAME.vhdx"; NewVHDSizeBytes = 50GB; BootDevice = "VHD"; Path = "C:\Virtual Machines\VMNAME"; SwitchName = (Get-VMSwitch).Name } ; New-VM @VM. This way you reuse parameters in different environments.
More useful management for your recording flow
Export a VM: Export-VM MiVM -Path "F:\vmbak" -CopyState creates a full export, useful for cloning demo scenarios. Saves you from having to reinstall just before recording.
Memory/CPU Information: Get-VMMemory y Get-VMCPUCount -VM MiVM They show you the current configuration. Avoid bottlenecks adjusting resources when you see FPS drops in capture.
Advanced Discovery: Get-Command *-VM o Get-Command *-VHD* help you find related cmdlets. With Where-Object You can filter by name/status: Get-Process | Where-Object { $_.ProcessName -Match '^sys.*' }. Use it to localize FFmpeg and stop it after X minutes.
Best practices: security, performance, and backups
Only enable the necessary firewall settings for file sharing (and disable them when finished), encrypt credentials, and use accounts with minimal privileges in your scripts. For performance, consider using a fast disk for the folder where you write your MP4s and limit the FFmpeg bitrate if you experience stuttering. If you use Xbox Game Bar, learn how to prevent the recording bar from appearing in your videos.
In data protection, for critical environments, it is recommended to use host-level backup solutions that create efficient, consistent, and fast copies . Third-party tools exist that cover Hyper-V and other hypervisors (for example, commercial suites that offer instant or V2V recovery). The documentation consulted mentions solutions such as NAKIVO Backup & Replication or Vinchin Backup & Recovery as market options; evaluate costs and suitability for your specific needs before adopting them.
With all of the above, you can organize a robust workflow: prepare the VM with PowerShell, move the necessary binaries via SMB/Copy-VMFile/VHDX, connect with VMConnect (if possible, in Enhanced Session mode), launch FFmpeg from PowerShell to capture the window, and control the process by time or event; in addition, save snapshots before starting and export the VM if you are going to repeat recordings. By unifying administration and capture via PowerShell, the work becomes repeatable, documentable, and fast to execute.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.