Scheduled tasks in keycloak for maintenance activity across all realms

Hi , we use keycloak for authentication in some of our system .
In one of our usecase we have a set of users which are system users, and always used in api contexts.
(basic auth ), since these are system users , they donot come through the browser based oAuth and hence the reset password etc are not applicable from them.

is there any way to exclude a set of systems users from password expiry?
if not, is there any way to send an automated email to users prior to password expiry?

i was looking to do this with a scheduledTask much like the cleareventscheduler or a clusterawarescheduler, but since this is a scheduled tasks it does not run in the context of any realm/user, so is there a way to get all the users across all the realms with some special attribute like require_reset_email=true or something like that?