Option Explicit Dim WMIService Dim VMList Dim VMSettingList Dim VMSettingList Dim VM Dim item Dim setting Dim component 'Get instance of' virtualization 'WMI service on the local computer Set WMIService = GetObject ("winmgmts: .rootvirtualization")' Get all the MSVM_ComputerSystem object Set VMList = WMIService.ExecQuery ("SELECT * FROM Msvm_ComputerSystem") For Each VM Print VMList if VM.Caption = "Virtual Machine" then WScript.Echo "================== ====================== "WScript.Echo" VM Name: "& VM.ElementName WScript.Echo" VM GUID: "& VM.Name WScript.Echo "VM State:" & VM.EnabledState 'Now get the BIOS GUID for this VM Set VMSettingList = WMIService.ExecQuery ("SELECT * FROM Msvm_VirtualSystemSettingData") For Each setting Print VMSettingList Dim tempVMname tempVMName = "Microsoft:" + VM.Name if setting.InstanceID = tempVMName then WScript.Echo "VM BIOS GUID:" & setting.BIOSGUID end if Next end if Next
Collect the Process ID information or GUID of Hyper-V Virtual Machine
When it comes to identifying a certain virtual machine component in the system, for some reason, such as changing hardware-related settings, fixing NTFS permissions problems ... then they We need to know the ID or GUID parameters of that virtual machine
TipsMake.com - When it is necessary to identify a certain virtual machine component in the system, for some reason, such as changing hardware-related settings, fixing NTFS permissions problems. . then we need to know the ID or GUID parameters of that virtual machine. In the following article, we will introduce you some basic operations to perform this process.
Find the Virtual Machine GUID parameter in the XML configuration file:
To do this, open the Virtual Machine's archive directory, where there will be a * .XML file with lots of specific settings for the virtual machine. Typically, the section name is quite long with many key characters and digits as the GUID of the Virtual Machine:
On the other hand, you can use a vbscript script written by Michael Michael from Microsoft TechNet. When active, the system will display a list of all virtual machines in the Hyper-V system and the corresponding GUID parameters.
Source code:
And then there is the PowerShell management library for Hyper-V - a very useful general project for users, with more than 80 major support functions. After conducting import of this management library, you type the command according to the syntax below:
get-vm | ft ElementName, name
A simpler way is to use the query function to be a repository of Windows Management Instrumentation repository - WMI. To do this, copy the following code and enter the PowerShell window with the corresponding parameters:
Get-WmiObject -Namespace rootvirtualization -class msvm_computersystem | select elementname, operationalstatus, processid, name | ft -auto
Examples are as follows:
After obtaining specific Process ID or GUID information, we can perform operations with the remaining Virtual Machines in the system without fear of impact or confusion. Good luck!
You should read it
- Create virtual machines in Hyper-V on Windows Server 2008
- How to export Hyper-V virtual machines in Windows 10
- How to import Hyper-V virtual machines in Windows 10
- How to rename Hyper-V virtual machines using PowerShell and Hyper-V Manager
- Create virtual machines with Hyper-V on Windows 8 and Windows 10
- How to change the default directory for hosting Hyper-V virtual machines in Windows 10
- Use the Virtual Machine Manager to quickly deploy Hyper-V
- Instructions for installing Hyper-V
- Monitor Hyper-V with the command line (Part 3): Check virtual machine status
- Monitor Hyper-V with the command line (Part 2): Basic monitoring commands
- Instructions for speeding up virtual machines in full set
- How to create a virtual machine repository for Hyper-V Quick Create