The other day it was necessary for me to confirm Windows OS build in Hyper-V guest VM without logging in into it. I simply received VM from the client but no credentials which I could use, but it was necessary to quickly confirm guest OS build. I was certain that there is a way to query such data from Hyper-V host without logging into guest and with no credentials. After some googling I was not able to find some simple command or one liner to pull this data (opening PS session into VM was not an option as it requires credentials), but I’ve found good function which does exactly what I need on Yusuf Öztürk blog, here it is:

View the code on Gist.

Once you have this function, you can use it like this:

Get-VMGuestInfo VMNAME -HyperVHost HyperVHostName

Sample output from this function: