Managing machines

Now, we will look at ways to manage the machines in a tenant. For this, we will start by checking a list of all available catalog items.

Listing shared and private catalog items

To get a list of catalog items, first build the header:

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add('Content-Type', 'application/json')
$headers.Add('Authorization', "Bearer $token")

Next, simply query the resources:

PS C:\> (Invoke-RestMethod -Method Get -Uri 
"https://vra.lab.com/catalog-
service/api/consumer/entitledCatalogItems" -Headers 
$headers).Content.catalogItem[0] | ConvertTo-Json

We get a list of items. For readability and easy understanding, we will select only one output. Since the output is ...

Get Mastering PowerCLI now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.