Hello,
I suggest you to use software restriction policies rules: https://learn.microsoft.com/en-us/windows-server/identity/software-restriction-policies/work-with-software-restriction-policies-rules
Or applocker , AppLocker helps you control which apps and files users can run.
If the Answer is helpful, please click "Accept Answer" and upvote it.