Get-Hypinventoryitem¶
Gets the resource items and child items from specified inventory locations using the resource type and a set of filtering and pagination parameters.
Syntax¶
Get-HypInventoryItem [-LiteralPath] <String> -ResourceType <String> [-ContinuationToken <String>] [-MaxRecords <Int32>] [-Skip <Int32>] [-ContainsName <String>] [-ForwardDirection <Boolean>] [-Tags <String>] [-Id <String>] [-AdditionalDataFilter <String>] [-Template <String>] [-Warn <Boolean>] [-Force <Boolean>] [-BearerToken <String>] [-TraceParent <String>] [-TraceState <String>] [-VirtualSiteId <String>] [-AdminAddress <String>] [<CommonParameters>]
Detailed Description¶
The `Get-HypInventoryItem` cmdlet gets the resource items and child items from specified inventory locations using the resource type and a set of filtering and pagination parameters.
`Get-HypInventoryItem` requires a Hosting Unit path and the ResourceType parameter. The ResourceType specifies the resource extension, such as `template` or `vm`.
Optional parameters control how many items to return, where to start the list of items and how to filter items so that only a subset are returned.
Related Commands¶
Parameters¶
Name | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|
LiteralPath | This specifies the XDHyp:\ path to the Hosting Unit for the inventory to use. This parameter is required. | true | true (ByValue) | |
ResourceType | This parameter specifies the type of the resources to return. This is a required parameter and corresponds to the resource Name extension, such as `template`, `vm` or 'launchtemplateversion'. | true | true (ByValue) | |
ContinuationToken | This parameter controls where to start including items from the inventory. This is usually the `Id` of an item and the included items begin after the given item is found. | false | true (ByValue) | |
MaxRecords | The maximum number of items to return for the given call of the cmdlet. The default is to return one item. | false | true (ByValue) | 1 |
Skip | Skips the specified number of records before returning results. Also reduces the count returned by -ReturnTotalRecordCount. | false | true (ByValue) | 0 |
ContainsName | This parameter filters items so that only the ones containing the given string in the `Name` are included. | false | true (ByValue) | |
ForwardDirection | Specifies whether the items are returned in forward page order (the default) or reverse. | false | true (ByValue) | True |
Tags | This parameter specifies a JSON dictionary where the keys are the tag names and the values are the tag values. The parameter is used to filter items which have the given tags. An item must have all the given tags to match. Special values of `Not tagged` and `All values` are supported. | false | true (ByValue) | |
Id | This parameter returns a single item with the given Identifier. | false | true (ByValue) | |
AdditionalDataFilter | This specifies a JSON dictionary of parameters to use in filtering resources using the AdditionalData properties. All values given must match for an item to be included. | false | true (ByValue) | |
Template | This parameter is used for the Machine Profile ResourceTypes only. It specifies a Template identifier or name to use in validation of the Machine Profile with the given Template. The validation will pass if the given Machine Profile resource is compatible with the given Template. Only Machine Profiles which pass this validation are included. | false | true (ByValue) | |
Warn | This parameter is used for along with any validation filtering parameter (such as TemplateId). It specifies that rather than excluding the items which failed validation, the item is included but with a Warning property added to the AdditionalData. This property carries a string which describes the reason for validation failure. | false | true (ByValue) | False |
Force | Specifies whether to return the full list of items or whether to exclude the items created as part of Machine Creation Services. The default behavior is to exclude the MCS created items. | false | true (ByValue) | False |
BearerToken | Specifies the bearer token assigned to the calling user | false | false | |
TraceParent | Specifies the trace parent assigned for internal diagnostic tracing use | false | false | |
TraceState | Specifies the trace state assigned for internal diagnostic tracing use | false | false | |
VirtualSiteId | Specifies the virtual site the PowerShell snap-in will connect to. | false | false | |
AdminAddress | Specifies the address of a XenDesktop controller the PowerShell snap-in will connect to. You can provide this as a host name or an IP address. | false | false | Localhost. Once a value is provided by any cmdlet, this value becomes the default. |
Input Type¶
¶
Return Values¶
System.Management.Automation.Psobject¶
A list of inventory items which are found in the given Hosting Unit inventory of the given ResourceType and matching any optional filtering parameters. As a convenience the first item of the list contains AdditionalData fields for `TotalItemsCount`, `TotalFilteredItemsCount` and `Tags`. These fields provide the counts of all the items of the ResourceType in the inventory, the set of items which would match the filters and a set of tags which may be used to filter the items, respectively.
Notes¶
FIXME
FIXME
Examples¶
Example 1¶
PS C:\Users\admin> Get-HypInventoryItem -LiteralPath "XDHyp:\HostingUnits\ctx-test" -ResourceType vm<br><br>AdditionalData : {[ServiceOfferingDescription, T3 Micro Instance], [TenancyType, Shared], [NetworkMappings,<br><br> [[["subnet-074242d7489b7209e","us-east-1a.availabilityzone\\10.0.128.0/17<br><br> (vpc-0fa6e41d72507f877).network"]]]], [SecurityGroups, ["private.securitygroup"]]...}<br><br>FullName : aws-test-non-persistent-vda-win2022 (i-0d2abbcbc89876ed2).vm<br><br>FullPath :<br><br>Id : i-0d2abbcbc89876ed2<br><br>IsContainer : False<br><br>IsMachine : True<br><br>IsSnapshotable : True<br><br>IsSymLink : False<br><br>Name : aws-test-non-persistent-vda-win2022 (i-0d2abbcbc89876ed2)<br><br>ObjectPath : /aws-test-non-persistent-vda-win2022 (i-0d2abbcbc89876ed2).vm<br><br>ObjectType : Vm<br><br>ObjectTypeName : vm<br><br>PS C:\Users\admin> Get-HypInventoryItem -LiteralPath "XDHyp:\HostingUnits\ctx-test" -ResourceType template<br><br>Description : Canonical, Ubuntu, 16.04 LTS, amd64 xenial image build on 2019-06-28<br><br>HasPersistentRootVolume : True<br><br>IsWindowsTemplate : True<br><br>Owner : 679593333241<br><br>AdditionalData : {[BlockDeviceCount, 1], [EnaSupport, True], [HibernationSupported, False], [Warning, Unable<br><br> to find snapshot or instance for AMI;]...}<br><br>FullName : ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20190628-d83d0782-cb94-<br><br> 46d7-8993-f4ce15d1a484-ami-0cfee17793b08a293.4 (ami-021d9d94f93a07a43).template<br><br>FullPath :<br><br>Id : ami-021d9d94f93a07a43<br><br>IsContainer : False<br><br>IsMachine : False<br><br>IsSnapshotable : False<br><br>IsSymLink : False<br><br>Name : ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20190628-d83d0782-cb94-<br><br> 46d7-8993-f4ce15d1a484-ami-0cfee17793b08a293.4 (ami-021d9d94f93a07a43)<br><br>ObjectPath : /ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20190628-d83d0782-cb94<br><br> -46d7-8993-f4ce15d1a484-ami-0cfee17793b08a293.4 (ami-021d9d94f93a07a43).template<br><br>ObjectType : Template<br><br>ObjectTypeName : template<br><br>PS C:\Users\admin> Get-HypInventoryItem -LiteralPath "XDHyp:\HostingUnits\ctx-test" -ResourceType template -ContainName persistent | select Name<br><br>Name<br><br>----<br><br>test-non-persistent-vda-win2022 (ami-0a2d913927e0352f3)<br><br>PS C:\Users\admin> Get-HypInventoryItem -LiteralPath "XDHyp:\HostingUnits\ctx-test" -ResourceType vm -MaxRecords 100 | select Name<br><br>Name<br><br>----<br><br>test-non-persistent-vda-win2022 (i-0f33601c7439a81aa)<br><br>test-Automation (i-021f404ff81e4b3b3)<br><br>test-non-persistent-vda-win2022-2 (i-0821ca8ba8c3d171c)<br><br>test-Bastion (i-026182c752bd20329)<br><br>test-AD (i-09dcfc3180ac723ea)<br><br>test-non-persistent-hibernation-vda-win2022 (i-02747245f4fd643e6)<br><br>test-Ubuntu-MP-test (i-0f311930f6509955b)<br><br>test-persistent-vda (i-00c55f1107b662c04)<br><br>aws-test-non-persistent-vda-win2022 (i-0d2abbcbc89876ed2)<br><br>PS C:\Users\admin> Get-HypInventoryItem -LiteralPath "XDHyp:\HostingUnits\ctx-test" -ResourceType vm -MaxRecords 100 -Skip 2 | select Name<br><br>Name<br><br>----<br><br>test-non-persistent-vda-win2022-2 (i-0821ca8ba8c3d171c)<br><br>test-Bastion (i-026182c752bd20329)<br><br>test-AD (i-09dcfc3180ac723ea)<br><br>test-non-persistent-hibernation-vda-win2022 (i-02747245f4fd643e6)<br><br>test-Ubuntu-MP-test (i-0f311930f6509955b)<br><br>test-persistent-vda (i-00c55f1107b662c04)<br><br>aws-test-non-persistent-vda-win2022 (i-0d2abbcbc89876ed2)
Description¶
Gets the first template resource from the ctx-test Hosting Unit
Example 2¶
PS C:\Users\admin> Get-HypInventoryItem -ResourceType "launchtemplateversion" -LiteralPath "XDHyp:\HostingUnits\ctx-test" -MaxRecords 100
Description¶
This will return first 100 launch template versions in that hosting unit.
Example 3¶
PS C:\Users\admin> Get-HypInventoryItem -ResourceType "launchtemplateversion" -LiteralPath "XDHyp:\HostingUnits\ctx-test" -MaxRecords 100 -Skip 100
Description¶
This will return 100 launch template versions after skipping first 100 in that hosting unit.
Example 4¶
PS C:\Users\admin> $items = Get-HypInventoryItem -ResourceType "launchtemplateversion" -LiteralPath "XDHyp:\HostingUnits\ctx-test" -MaxRecords 200<br><br> PS C:\Users\admin> $items[0].AdditionalData<br><br> Key Value<br><br> --- -----<br><br> ServiceOfferingDescription T3 Large Instance<br><br> TenancyType Shared<br><br> HibernationSupported False<br><br> NetworkMappings [[["subnet-074242d7489b7209e","us-east-1a.availabilityzone\\10.0.128.0/17 (vpc-0fa6e41d72507f877).network"]]]<br><br> SecurityGroups ["private.securitygroup"]<br><br> PositionAndCount {"Item1":1,"Item2":1}<br><br> Hypervisor nitro<br><br> TotalItemsCount 29<br><br> TotalFilteredItemsCount 29<br><br> Tags {"user":["test-user"]}<br><br> PS C:\Users\admin> $items[5].AdditionalData<br><br> Key Value<br><br> --- -----<br><br> ServiceOfferingDescription T3 Small Instance<br><br> TenancyType Shared<br><br> HibernationSupported False<br><br> NetworkMappings [[["subnet-074242d7489b7209e","us-east-1a.availabilityzone\\10.0.128.0/17 (vpc-0fa6e41d72507f877).network"]],[["subnet-074242d7489b7209e","us-east-1a.availabilityzone\\10.0.128.0/17 (vpc-0fa6e41d72507f877).network"]]]<br><br> SecurityGroups ["private.securitygroup"]<br><br> PositionAndCount {"Item1":2,"Item2":12}<br><br> Hypervisor nitro<br><br> PS C:\Users\admin> $items = Get-HypInventoryItem -ResourceType "launchtemplateversion" -LiteralPath "XDHyp:\HostingUnits\ctx-test" -MaxRecords 200 -Template "ami-01548d6ca90670e7e" -Warn $true<br><br> PS C:\Users\admin> $items[3].AdditionalData<br><br> Key Value<br><br> --- -----<br><br> ServiceOfferingDescription T2 Medium Instance<br><br> TenancyType Shared<br><br> HibernationSupported False<br><br> PositionAndCount {"Item1":1,"Item2":1}<br><br> Hypervisor xen<br><br> Warning Block device count mismatch;<br><br> PS C:\Users\admin> Get-HypInventoryItem -ResourceType "launchtemplateversion" -LiteralPath "XDHyp:\HostingUnits\ctx-test" -MaxRecords 5 -Warn $true -AdditionalDataFilter "{'Hypervisor' : 'nitro'}" | Select Name<br><br> Name<br><br> ----<br><br> lt-0bb652503d45dcbcd (9)<br><br> lt-0e1146edd2bbd3d18 (1)<br><br> lt-0e1146edd2bbd3d18 (2)<br><br> lt-0e1146edd2bbd3d18 (3)<br><br> lt-0e1146edd2bbd3d18 (4)
Description¶
Examples of Additional Data returned for launch template version and different filters and Parameters.