msi: Factor out common code to execute custom action commands.