Using PowerShell to Ping Test a VM

I have been spending some time creating PowerShell snippets to help when you need to troubleshoot / debug a Hyper-V environment.  Here is a handy one-liner that I recently created:

Get-VM "File Server" | Select -ExpandProperty NetworkAdapters | Select -ExpandProperty IPAddresses | %{Ping $_}

When you run this you get the following output:

As you can see - it gets every IP address from the specified virtual machine and attempts to ping that specific IP address.  This is a quick and handy way to see if a virtual machine is up and running.

Cheers,
Ben