Skip to main content

Write Legacy Custom Inventory Fields with an fwcld Fileset

DescriptionWhat this legacy recipe does

AlthoughThis theserecipe formswrites ofthe Customlegacy Fieldnumbered mayinventory stillfields bewith used,fwcld since-custom_write. FileWave 12.7 additionalFor new methodsinventory ofrequirements, 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:use Custom Fields, which offer more flexible definitions and reporting. Keep this method where an existing script, report, or integration still depends on the legacy field names.

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 solutionlegacy isschema to use the custom inventory fields introduced in FileWave version 7.0.0. There areprovides 20 fieldsslots for each data type :type: String, Integer, Boolean, Date.and StartingDateTime. inChoose versionan 8.5unused key from the FileWavecomplete Clientmatrix canbelow, acceptthen input.make sure the command returns a value that matches that key's data type.

YouThe can use this recipe to deploy adownloadable Fileset that is able to addsupplies the valuewrite youscript. wantConfigure basedit onwith a shell command. The script is already written for you and available in the Fileset, you only need to provide the command that outputsprints only the inventory value you want to add.store:

$ fwcld -custom_write -key <key_name> [-value <value_to_save] [-silent]

IngredientsRequirements

  • FWFileWave Central
  • A command that outputs neededthe infrmationrequired inventory value
  • Basic understandingscripting of scriptingknowledge

Directions

Built-into theThe FileWave Client iscan capture command output and store it in the abilityselected to receive the output of a command and save that to thelegacy inventory DB.field.

  1. Determine whatRun the command manually, confirm its output of your command istype, and select an unused legacy key from the bestmatrix place to savebelow.

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 (FW 15.4.2 and lower)
C:\Program Files (x86)\FileWave\fwcld -custom_write -key FIELD_TO_SAVE_TO -value INFORMATION_TO_SAVE
Windows (FW v15.5.0 or higher)
C:\Program Files\FileWave\client\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.

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-