What are the gui selections in script options, run with user rights, using 64-bit,, signed?
Unfortunatelly it is well known, that script esecution is very slow in Intune and if you want to make it faster, you would need to create win32 app of the script.