I can’t speak to windows, but invoking osquery via a shell exec never feels right. If you were recommending application patterns, osqueryd is a daemon designed to handle a variety of things. Sticking with this feels like all the usual shell exec delicacy.