Creating Schema Extensions
Creating Schema Extensions
Schema extensions allow to extend the information DSM 2022.2 is storing about the object types "Computer", "User" and "Software Package" in the DSMDB with new properties.
These properties are bundled into groups. Be aware that the names of the groups as well as the names of the properties must be unique, i. e. Computer-objects and User-objects can't be extended with the same group. For the sake of consistency it is not allowed to remove schema extensions.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
Properties are bundled into groups. These groups can be created using the cmdlet Update-EmdbObjectSchema. This cmdlet expects at least a drive, a schema type for which the new group should be created and a name for the new group as parameters:
Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -AddGroup 'Location' |
In the example a group 'Location' is created for the schema type 'Computer'. This group can be filled with properties of various types. First a property named 'Manager' will be created. It is of type 'TextField' and its maximum length is 128 characters:
Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -ModifyGroup 'Location' -AddProperty 'Manager' -ValueType textfield -MaxLength 128 |
Next a property of type 'OptionList' is created. An option list contains pairs of key and value items. The value, which corresponds to the selectable option in the DSMC, is localized. In the next example in a first step a data structure containing the key and value items is created, then in a second step, the cmdlet Update-EmdbObjectSchema is invoked with the data structure as the PredefinedValues parameter:
$MySites = @{"pforzheim" = @{"de" = "Pforzheim"; "en" = "Pforzheim"}; "muenchen" = @{"de"="Muenchen"; "en" = "Munich"}} Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -ModifyGroup 'Location' -AddProperty 'Site' -ValueType optionlist -PredefinedValues $MySites |
After invoking the command the group 'Location' contains two properties: 'Manager', which is of type 'TextField' and 'Site', which is of type 'OptionList'.
In the next example the property 'Site' is extended with an additional option. Therefore a new data structure similar to the previous one is created. But in this example it only contains the new option and its localized display values:
$MySites = @{"berlin" = @{"de" = "Berlin"; "en" = "Berlin"}} Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -ModifyGroup 'Location' -ModifyProperty 'Site' -PredefinedValues $MySites |
Schema Extensions can't be deleted, but as an alternative they can be deactivated. In the next example the previously added option should be deactivated. Therefore the same data structure as before is used, it is only slightly modified. The values of the option keys that should be deactivated are set to $false and then the cmdlet is invoked:
$MySites = @{"berlin" = $false} Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -ModifyGroup 'Location' -ModifyProperty 'Site' -PredefinedValues $MySites |
Using the objects $true and $false changes the semantics of the cmdlet. It does not change the localized display names to $true or $false, but activates or deactivates an option. Properties can be deactivated, too, as the next example shows:
Update-EmdbObjectSchema -Drive emdb -SchemaType Computer -ModifyGroup 'Location' -ModifyProperty 'Site' -isDisabled $true |
Now the property 'Site' is deactivated. Properties can be re-activated by assigning $false to the parameter -isDisabled.