Hyper-V How To: ID a VM for Scripts
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.
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.