Yes, with some bash script, it wouldn't be hard to do it.
I'm thinking maybe with the help of this API request, you can get your agents
https://documentation.wazuh.com/current/user-manual/agents/listing/listing.html and parse the ID which is the name for the databases.
With
agent_control -l and some greps you could achieve the same, but a JSON response would be easier to parse.
Once you have the IDs you can pass those arguments to a bash function that executes that query.
function force_bs {
sqlite3 /var/ossec/queue/db/$1.db 'update vuln_metadata set last_full_scan = 0'
}
To parse the JSON response, JQ it's a great tool
https://www.baeldung.com/linux/jq-command-json.