API Reference
Class
HyperVVirtualMachineQuery
Queries native Hyper-V virtual machine inventory through the Hyper-V WMI v2 provider.
Inheritance
- Object
- HyperVVirtualMachineQuery
Methods
public static List<HyperVVirtualMachineInfo> Get(String computerName = null, String[] namePatterns = null, Nullable<TimeSpan> timeout = null) #Returns:
List<HyperVVirtualMachineInfo>Gets Hyper-V virtual machines from root\virtualization\v2.
Parameters
- computerName System.String = null
- Target computer name. Blank or . uses the local computer.
- namePatterns System.String[] = null
- Optional wildcard patterns matched against VM friendly name and WMI identity.
- timeout System.Nullable{System.TimeSpan} = null
- Optional WMI query timeout.
Returns
Virtual machine rows. Returns an empty list when Hyper-V WMI is unavailable.
public static async Task<List<HyperVVirtualMachineInfo>> GetAsync(String computerName = null, String[] namePatterns = null, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #Returns:
Task<List<HyperVVirtualMachineInfo>>Asynchronously gets Hyper-V virtual machines from root\virtualization\v2.
Parameters
- computerName System.String = null
- Target computer name. Blank or . uses the local computer.
- namePatterns System.String[] = null
- Optional wildcard patterns matched against VM friendly name and WMI identity.
- timeout System.Nullable{System.TimeSpan} = null
- WMI query timeout.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
Virtual machine rows. Returns an empty list when Hyper-V WMI is unavailable.
Inherited Methods
public override Boolean Equals(Object obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object