Access Virtualization Manager through the PowerShell client
With SolarWinds Virtualization Manager Power CLI, you can access Virtualization Manager data in Microsoft PowerShell.
Download the PowerShell Client installer from the SolarWinds Customer Portal.
- Log in to the SolarWinds Customer Portal.
- Click License Management > License Management.
- Select Virtualization Manager from the product list.
- From the Agent Downloads section, download the PowerShell Client for Virtualization Manager.
- When the download is complete, install PowerCLI.
Connect to Virtualization Manager from PowerShell
To connect to the SolarWinds Virtualization Manager server, use the
Connect-H9Server cmdlet. For example,
Connect-H9Server akutz-hyper9 admin admin.
This creates a connection to the SolarWinds Virtualization Manager server
akutz-hyper9 using the credentials
Search in Virtualization Manager
When you are connected to Virtualization Manager, you always have an active query. At first, the query is empty, and returns no results. Run
Set-H9Query to set your active query and return a set of results. For example,
Set-H9Query * VirtualMachine.
This command sets your active query to all known virtual machines, and returns the number of results. The first parameter is a query, and the optional second parameter is the object type. After defining the query, run this command to view items 1 through 20 of the results:
Show-H9Results 1 20
The following command returns the same result:
Show-H9Results | Select-Object -first 20
The parameters are optional and you can also show all the items in the result set.
Displaying large result sets can take a long time.
Use configuration item references
Operations you can perform with Virtualization Manager can involve a large number of objects. Because of this, most Virtualization Manager cmdlets accept and return configuration item references. These are pointers to the actual data stored by SolarWinds Virtualization Manager.
To see the actual data, use the Get-H9Doc cmdlet:
$xml = Get-H9Result 1 1 | Get-H9Doc
This returns an [xml] object, for example:
PS C:\> $xml.virtualMachine.cpuAllocation
limit reservation shares sharesLevel
----- ----------- ------ -----------
45351 0 500 low
Install VMware vSphere PowerCLI
You can also install the VMware vSphere PowerCLI to take advantage of the integration of SolarWinds Virtualization Manager and VMware. Download the VMware vSphere PowerCLI from the VMware website.
You can use the ConvertTo-H9Ref command to retrieve a configuration item reference for a VMware object. For example,
Get-Vm | ConvertTo-H9Ref | Add-H9List.
This command retrieves all known virtual machines through the vSphere PowerCLI, converts each to a SolarWinds Virtualization Manager reference, and adds them to the active list.
This command works for managed objects that SolarWinds Virtualization Manager recognizes:
- Virtual machines
- Host servers
- Data stores