# Computer Custom Columns

KeyServer's computer database has many values related to hardware properties. Most of these are populated using various APIs and lookups on the client. In addition, KeyServer has 10 custom text fields which can be used for whatever values you want to add to the computers table. Each field holds a maximum of 63 bytes. These values can either be populated on each client computer (in registry or plist) or via KeyConfigure. Also note the Asset ID fields that are implemented in a similar way but serve a specific purpose.

### Enabling Custom Columns

Computer Details Window

In order to use custom computer columns, you must first define labels for them. Right-click in the column header of the Computers window and select "Define Columns...". This will bring up the Custom Computer Columns dialog, which has 10 text fields. Once you have entered one or more labels, you can see these Custom values either in the Custom pane of Computer Details, or by Customizing Columns in the Computers window.

### Filtering on Custom Columns

The Custom Columns are not displayed in the GUI area of computer filters. However you can make filters using the "Match this Filter" area using usr0 through usr9 as the column names. For more, see the Filters documentation.

### Gathering values from KeyAccess

KeyAccess 7.1.0.7 and higher will look for local values to be used in custom fields and send them to KeyServer as part of the hardware audit.

Windows KeyAccess looks in the registry in the directory:

HKLM\SYSTEM\CurrentControlSet\Services\KeyAccess\Settings\options


for keys assetCustom0, assetCustom1, ... assetCustom9. These keys can contain a text value which will be sent to KeyServer, or they can use special syntax to specify that KeyAccess should look in a different registry key for the text value to send to KeyServer. The syntax is <full\path\to\stringval>. For example, to get the description of the first cpu:

<HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\ProcessorNameString>


Mac KeyAccess looks for the same property names in:

/Library/Preferences/com.sassafras.KeyAccess.plist


So one way to set these values on a Mac is using the command line:

sudo defaults write /Library/Preferences/com.sassafras.KeyAccess assetCustom0 my_value


On Mac as well, you can specify that KeyAccess should look in a different plist for the string value that will ultimately be sent to KeyServer (this functionality was added in KeyAccess 7.3.0.7). For example, to specify that the first Remote Desktop “info” field should be used for the first KeyServer custom hardware field, do this:

sudo defaults write /Library/Preferences/com.sassafras.KeyAccess assetCustom0 "@com.apple.remotedesktop:Text1@"


This special syntax must start and end with the @ character, and contain the id of the application followed by a colon and the name of the property to be read from the plist.

If you want to avoid running defaults write on your clients, you can also customize the K2Client installer using k2clientconfig to write these preferences during an install. For example, to use the Remote Desktop info fields as the first four K2 custom fields, you would do:

./k2clientconfig -v assetCustom0=@com.apple.remotedesktop:Text1@
-v assetCustom1=@com.apple.remotedesktop:Text2@
-v assetCustom2=@com.apple.remotedesktop:Text3@
-v assetCustom3=@com.apple.remotedesktop:Text4@
K2Client.pkg


Whenever a value is found on the client, this is sent to KeyServer, and overwrites whatever value is already in the KeyServer database for this computer.

### Entering values directly in KeyConfigure

Custom Columns Pane

In the Custom pane of a Computer Details window, you can edit/enter/save text values manually. Note though that if a value is discovered on a client, this will overwrite anything that has been manually entered. Generally, you will either populate values on clients, or populate them manually in KeyConfigure - not both.

### Importing values

Custom columns can also be imported to KeyConfigure from a text file. For details on how to do this, read the blog post on Importing Data to Computer Asset fields.