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 a PowerShell object (in this case, it is an array of objects), we are just selecting the first element and then converting it to JSON format:
[
{
"id": "bda84bcb-d3f6-4332-8781-89d146ef5e28",
"version": 2,
"name": ...