O'Reilly logo

Mastering PowerCLI by Sajal Debnath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required