Hi,
I guess this issue could be fixed by modifying the script codes. Since we are not the best resource for coding, I'd recommend you post your question in the following forum for further assistance:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your
interaction with us. Thank you for your understanding.
Steve Fan
TechNet Community Support