Score:0

use Test-VHD cmdlet without hyper-v installed role

ht flag

I wrote a powershell script to have a vhdx image from physical server using Disk2vhd cli with schedule and retention. Disk2vhd doesn't have an exit code so I cannot understand when it works and when it fail. I thought about using the Test-VHD cmdlet that returns True or False when the vhdx is ok or not. I can't find clear documentation about this, it seems to be related to differential disks, so I tried an empirical proof:

I started disk2vhd to create a vdisk from an hyper-v host because I know "Test-vhd" cmdlet was present, I taskkilled disk2vhd processes and then I tested with Test-VHD, and it return $False, as it supposed to return when the VHDX is corrupted. So one problem solved.

Now I would like to start using this on a physical server, but I notice that "Test-VHD" is not present, I would like to know if someone knows how to add it on the physical servers without installing all the Hyper-v ecosystem.

The physical servers are all on Windows Server 2012 R2 and I cannot Install 3rd part softwares for backups and cannot easily reboot, so the only way is to build my dirty messy script.

I tried this cool how-to : Adding Hyper-V Powershell cmdlets to an offline Hyper-V host

and the command appear, but when I try to start the cmdlet it returns:

TEST-VHD : The Hyper-V role is not installed on the destination host. Add the Hyper-V role on that host and then run this cmdlet again. At line:1 char:1

it's seems that the hyper-v role need to be fully installed right? I'm looking for an alternative way, any help or suggestion is apreciated, thanks!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.