Already a NinjaOne customer? Log in to view more guides and the latest updates.

Reading from or Writing to Custom Fields in Scripts

 

NinjaDojo-logo-darkblue.png

For more detailed information about scripting and custom fields, please see Custom Fields and Documentation: CLI and Scripting. For more information about scripting, please see Automation Library (Scripting).

Important Notes:
  • When you create your custom field, you need to make sure that you set the Scripts permission to ensure that you can read or write to the field from your scripts — as appropriate for the script you're using.
  • Writing to custom fields will overwrite the current value. 
  1. To create a new custom script that pushes information to custom fields, navigate to Administration > Library > Automation > Add > New Script.
    admin_library_automation_add_script.png
    From here you can access the new NinjaOne custom snippets. Custom snippets are building blocks within scripts that say, "read this" or "write this". They assist in the creation of a script used for custom fields.
    script_custom snippets.png
  2. Select the programming language of choice, operating system, and architecture. Use ctrl + space on your keyboard to bring up the snippets menu.
    custom fields in script.png
    Now, when you run the script on a device (either by Scheduled Task, Scheduled Script, or ad-hoc), you can have information automatically pulled from or populated to the referenced custom field.

Check out our custom and shared scripts page in the Dojo for additional resources. 

FAQ

Next Steps