Hello Thank you for your question and reaching out. I can understand you are having query\issues related to Logon scripts.
- On the effect User please rung gpresult /h C:\test\gpresult.html to see if the GPO is properly applied and which logon script should be applied for this user.
- Please check if there is any Loopback processing is enabled in GPO.
- Please try to put some logging to trace the script behavior
- Please check if AD health is Good and all DCs are synced. --If the reply is helpful, please Upvote and Accept as answer--