Hello PerserPolis-1732,
Thank you for posting in Q&A forum.
I assume you have one domain, then we can follow the steps below:
1.Create one OU on Domain Controller.
2.Put the user accounts that need to run this command line or Power Shell script to this OU.
3.Create one GPO and rename this GPO.
For example:
I rename this GPO (GPO name is tt1 and its GUID is {5EE96627-35BD-434C-9C6A-4AE328E7D13A}).
4.Put the this command line or Power Shell script file to this folder below: \domain.com\SYSVOL\domain.com\Policies{5EE96627-35BD-434C-9C6A-4AE328E7D13A}\User\Scripts\Logon
5.Edit this GPO as below.
6.If the specific users logon, then this user will apply the logon GPO.
I hope the information above is helpful.
If you have any question or concern, please feel free to let us know.
Best Regards,
Daisy Zhou
If the Answer is helpful, please click "Accept Answer" and upvote it.