# Add FileWave Custom Inventory fields remotely using a Fileset ## Description

Although these forms of Custom Field may still be used, since FileWave 12.7 additional new methods of Custom Fields have been introduced. The newer form allow for backward compatibility to these older Custom Fields, but provide much greater flexibility and would be recommended. Details on these may be found here: [Custom Fields](https://kb.filewave.com/books/custom-fields/page/custom-fields "Custom Fields")

Let's say you are using FileWave Integrated Inventory and you want to collect inventory data fields that FileWave does not report yet (you can check if you field is supported in the component list when you edit a query). The solution is to use the custom inventory fields introduced in FileWave version 7.0.0. There are 20 fields for each data type : String, Integer, Boolean, Date. Starting in version 8.5 the FileWave Client can accept input. You can use this recipe to deploy a Fileset that is able to add the value you want based on a shell command. The script is already written for you and available in the Fileset, you only need to provide the command that outputs the value you want to add. ``` $ fwcld -custom_write -key [-value String Integer Boolean DateTime custom\_string\_01 custom\_integer\_01 custom\_bool\_01 custom\_datetime\_01 custom\_string\_02 custom\_integer\_02 custom\_bool\_02 custom\_datetime\_02 custom\_string\_03 custom\_integer\_03 custom\_bool\_03 custom\_datetime\_03 custom\_string\_04 custom\_integer\_04 custom\_bool\_04 custom\_datetime\_04 custom\_string\_05 custom\_integer\_05 custom\_bool\_05 custom\_datetime\_05 custom\_string\_06 custom\_integer\_06 custom\_bool\_06 custom\_datetime\_06 custom\_string\_07 custom\_integer\_07 custom\_bool\_07 custom\_datetime\_07 custom\_string\_08 custom\_integer\_08 custom\_bool\_08 custom\_datetime\_08 custom\_string\_09 custom\_integer\_09 custom\_bool\_09 custom\_datetime\_09 custom\_string\_10 custom\_integer\_10 custom\_bool\_10 custom\_datetime\_10 custom\_string\_11 custom\_integer\_11 custom\_bool\_11 custom\_datetime\_11 custom\_string\_12 custom\_integer\_12 custom\_bool\_12 custom\_datetime\_12 custom\_string\_13 custom\_integer\_13 custom\_bool\_13 custom\_datetime\_13 custom\_string\_14 custom\_integer\_14 custom\_bool\_14 custom\_datetime\_14 custom\_string\_15 custom\_integer\_15 custom\_bool\_15 custom\_datetime\_15 custom\_string\_16 custom\_integer\_16 custom\_bool\_16 custom\_datetime\_16 custom\_string\_17 custom\_integer\_17 custom\_bool\_17 custom\_datetime\_17 custom\_string\_18 custom\_integer\_18 custom\_bool\_18 custom\_datetime\_18 custom\_string\_19 custom\_integer\_19 custom\_bool\_19 custom\_datetime\_19 custom\_string\_20 custom\_integer\_20 custom\_bool\_20 custom\_datetime\_20 - Create a fileset with a script where it uses the clients macOS ``` /usr/local/sbin/FileWave.app/Contents/MacOS/fwcld -custom_write -key FIELD_TO_SAVE_TO -value INFORMATION_TO_SAVE ``` Windows ``` C:\Program Files (x86)\FileWave\fwcld -custom_write -key FIELD_TO_SAVE_TO -value INFORMATION_TO_SAVE ``` - Associate this fileset

Date format may be supplied as either YYYY/MM/DDTHH:MM:SS or YYYY-MM-DDTHH:MM:SS. E.g 2014/02/20T15:22:43 or 2014-02-20T15:22:43

## Examples Setting "custom\_bool\_13" to a false: ``` $ fwcld -custom_write -key custom_bool_13 -value 0 $ fwcld -custom_write -key custom_bool_13 -value false ``` Setting "custom\_bool\_13" to true: ``` $ fwcld -custom_write -key custom_bool_13 -value 1 $ fwcld -custom_write -key custom_bool_13 -value true $ fwcld -custom_write -key custom_bool_13 -value something ``` Setting "custom\_date\_02" to a date: ``` $ fwcld -custom_write -key custom_date_02 -value 2014-02-20T15:22:43 ``` To remove any key value, just leave off the -value parameter - so to reset the "custom\_date\_02" value back to it's default. ``` $ fwcld -custom_write -key custom_date_02  ``` Example: Saving admins to string 01 ``` #!/bin/sh # This script is a verification sample # benm @ fw now=$(date +"%Y-%m-%d-%H-%M") echo "$now -- Writing current admins to inventory" #writes the current administrators to an inventory field currentadmins=$(dscacheutil -q group -a name admin |grep users) /usr/local/sbin/FileWave.app/Contents/MacOS/fwcld -custom_write -key custom_string_01 -value "$currentadmins" ``` ## Notes If you set your script to run at the "verification" phase then it will continue to run (default every 24hrs), for more on scripts see: [Fileset Scripts](https://kb.filewave.com/books/filesets-payloads/page/fileset-scripts-overview "Fileset Scripts"). ## Useful Commands - The current logged in user: `stat -f%Su /dev/console` - The Kernel version: `uname -r` - Battery Condition: `system_profiler SPPowerDataType | awk '/Condition/ {print $NF}'` - Current admins: `dscl . read /Groups/admin GroupMembership | cut -d " " -f 2-`