# CMS_GetInventory

> Gets inventory values from the database, from either the Hardware, Custom, or Logon inventory tables.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/cms-functions/cms-getinventory/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Gets inventory values from the database, from either the Hardware, Custom, or Logon inventory tables.

|                                                                                                                                                                                                                                                                         |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <mark style="background: #deebff;">Please note, that this is an expensive call, seen from the Frontend/database perspective. Calling this function repeatedly from a package could result in overall slower performance. This function should be used with care.</mark> |

### Syntax

**VBScript**

```vb
CMS_GetInventory(table, category, entry) As string
```

**PowerShell**

```powershell
[string]CMS_GetInventory -table <string> -category <string> -entry <string>
```

### Parameters

#### table (string)

Table (string)

This is the table toward which the request is made, and it can be either **HWI** (hardware inventory), **LGI** (logon inventory), or **CSI** (custom inventory).

#### category (String)

Category name

#### entry (String)

variable name

### Return value

**VBScript**

The function returns a boolean (bStatus), indicating if the call was successful. The requested value will be stored in gsValue.

**PowerShell**

Result will be returned as the result of the function.

### Example

**VBScript**

```vb
If bStatus Then bStatus = CMS_GetInventory("hwi", "System", "Name")
If bStatus Then bStatus = Job_WriteLog("System", "Name: " & gsValue, bStatus, True)
```

**PowerShell**

```powershell
$systemname = CMS_GetInventory -table "hwi" -category "System" -entry "Name"
$cs.Job_WriteLog("System name: $systemname")
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[CMS_AddHardwareInventory](/capainstaller/vb-scripting-library/cms-functions/cms-addhardwareinventory/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/) [Business Unit support](/capainstaller/vb-scripting-library/addendum/business-unit-support/)

[CMS_AddCustomInventory](/capainstaller/vb-scripting-library/cms-functions/cms-addcustominventory/)
