Retrieving Schema Information

Retrieves schema information.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


Schema Information is bound to the PowerShell drive representing the Business Logic Server. So as a first step, the EmdbInfo-property of the drive object associated with the drive 'emdb:' is retrieved:


$MyDrive = Get-PSDrive emdb

$MyInfo = $MyDrive.EmdbInfo


Now the schema information of a computer can be retrieved using the  GetSchemaInfo()-method:


$MySchemaInfo = $MyInfo.GetSchemaInfo("Computer")


The $MySchemaInfo data structure holds the returned schema information. In particular it contains a list holding all property groups associated with Computers, with can be displayed with the following command:


$MySchemaInfo.PropGroupLinkList | Select PropGroupDefTag


All standard property groups and the property groups introduced with schema extensions are returned. Now the properties of a certain group can be retrieved. In the next example we retrieve all properties of the property group 'BasicInventory' and store them in a variable named $MyProperties:


$MyPropertyGroupInfo = $MyInfo.GetPropertyGroupInfo("basicinventory")

$MyProperties = $MyPropertyGroupInfo.PropertyDefList


Now information about the properties can be retrieved. The localized property names are stored in the array-typed attribute named 'DisplayNameList'. In the next example all English property names are retrieved:


$MyProperties | ForEach-Object{$_.DisplayNameList | Where-Object{$_.culturecode -eq "en"}}


Retrieve all information about properties having the term 'ram' in any supported language in their localized names:


$MyProperties | ForEach-Object{$_.DisplayNameList | Where-Object{$_.representation -match "ram"} | Sort-Object -Property id -u}