Forum Discussion
Exactly right Mike.
RE: Batchscript vs. Script
It is generally correct that Batchscript runs more efficiently than script because the collector executes the script one time and the script collects the data for each and every instance with a single run. With Script, the collector runs the script once per instance. Script is sometimes/rarely/not often better in the case that the collection can't be done in bulk.
For example, an API call has to be executed to collect the data and the API only offers the data when specifying the instance as part of the API resource (/api/{instanceID}/data). In this case, if you did a Batchscript, you would fetch the list of IDs and loop through each, executing the API call once per instance. Depending on the number of instances and the speed of the response from the API, this could end up timing out. This method executes the API calls serially.
If you used Script instead, the Collector would execute once per instance, essentially running them in parallel. Each script would only be calling the API once so it should return much more quickly than running all fo them in a loop. You stand less of a chance of timing out in this case. However, care must be given to Collector performance since this method could significantly increase the number of tasks the Collector has to execute.