Update fields for different assets

I was hoping to find a way to update a custom field for other assets from a script (or API, but I’m less familiar with APIs). I.E. Asset A updates the field “How_Many_Apples” for Assets B and C.

The intent is to export M$ LAPS passwords to a custom field. A script specific to the asset does not work as it would require the machine to install the Active Directory module for powershell. I’m hoping this would just be run from a DC, ensuring up to date info.

Open to any creative solutions!

I believe this should be possible. The custom fields are exposed to the API, and there is an update asset endpoint. So in theory yes, it shouldn’t be too hard to create a script that would run on one machine, grab the devices you want to update, and update them with the appropriate values.

I’ve not had a need to do this yet, so I can’t promise it 100%, but the data appears to be there. If you use 1 machine to do this, I’d highly recommend that machine is very much secure since that will have the API key either living on it, or being passed to it.

So now that I had a little time to actually look at that part of the API, it’s 100% possible to update custom fields on any asset through the use of the API, so yes, you can do what you’re asking.

I really appreciate the info - I’ll start looking into the API documentation a little deeper!

No problem. I see 2 ways to do it that would work well for you most likely.

Build a function that you can feed a set of IDs to (or names, and get the IDs by querying the API) and then loop through and update each one.
Or, if you are doing this across your fleet, then you can just query the API to get the appropriate IDs and update each.

And so you don’t have to wonder since I didn’t seem to find it in their documentation when I started using the API here are 2 key pieces you need when passing the json back.

        "asset_type_name" = "Syncro Device"
        "asset_type_id"   = 218285