It is even simpler with:
runagent -m nextcloud1 occ user:list
There’s an occ helper/wrapper in the app
occ