Can wp-cli display all users and their roles across all sites in a multisite instance?

List all the admins of each site

Side note: Dividing these up by site would also be handy.

Let’s do that here:

We can list the url of each site with:

wp site list --field=url

We can list all administrators of a given site with:

wp user list --role=administrator --url=https://example.tld/site1

These commands can be combined with e.g. xargs as suggested on the wp-cli site:

wp site list --field=url  \
  | xargs -I % wp user list --role=administrator --url=%

We might also want to use | tail --lines=+2 to skip the url header, of the first command as explained in the tail manual and answers like this one.

Thanks to @grappler for suggesting --field="url" instead of --fields="url" with | tail --lines=+2 to skip the header row.

If we want to display the url before each table:

for url in $( wp site list --field="url" ); \
do \
   echo $url; \
   wp user list --role=administrator --url=$url; \
done;