That's right. Using the local script option is not a recommended choice for production. This is because the data reporting frequency is higher than other onboarding methods when onboarding using a local script. Microsoft suggests that this could have environmental impact.
I suggest investigating why those devices are not being onboarded with Defender. Utilize the methods recommended for mass onboarding, such as Intune, since you already use it. I'm sharing a few reference guides with you that might be helpful in resolving this issue.
- Make sure you are meeting the Minimum License Requirements for on-boarding clients to Defender: https://video2.skills-academy.com/en-us/microsoft-365/security/defender-endpoint/run-analyzer-windows?view=o365-worldwide
- Make sure you are meeting the Hardware and Software requirements on those devices that are not getting on-boarded: https://video2.skills-academy.com/en-us/microsoft-365/security/defender-endpoint/minimum-requirements?view=o365-worldwide#hardware-and-software-requirements
- Run the Defender client analyzer tool on the device and Investigate the logs: https://video2.skills-academy.com/en-us/microsoft-365/security/defender-endpoint/run-analyzer-windows?view=o365-worldwide
If any of the above methods are not working, Log a Support ticket with Microsoft as it could be an issue at the backend.
--If the response is helpful, please click "Accept Answer" and upvote it --