If you are scripting virtual machine management activities, you will need to uniquely identify and sort VMs. John Howard’s blog post tells you how, using the BIOS GUID.

http://blogs.technet.com/jhoward/archive/2008/09/16/how-to-use-uniquely-identify-a-virtual-machine-in-hyper-v.aspx

If you are scripting in this area, you will want to download the free ebook on Keith Hill’s blog you can download: Effective PowerShell: The Free eBook.