Mr-Tbone / Intune

Collection of my Intunescripts
22 stars 11 forks source link

Intune-Set-PrimaryUsers.ps1 - 6000+ Devices runs into memory exception error. #4

Closed acmcomputers closed 5 months ago

acmcomputers commented 9 months ago

Hej,

I've been playing with the updated script version to try and tackle an environment with a large number of devices. Initially I wrote a variation to your script where I filtered the devices/sign ins to a more granular level but was still plagued with throttling at regular intervals. I've now looked into your batching approach, but I'm still hitting a wall on occasion with the following:-

Thread failed to start. (Thread failed to start. (Exception of type 'System.OutOfMemoryException' was thrown.))

Do you have any recommendations on what can be done to alleviate this?

Many thanks Andrew

Mr-Tbone commented 5 months ago

It might not be possible to get around this. When running the free Azure Automation, you only have a limited set of resources. So if you have to much data to process, it will fail. Then the only solution is to setup a hybrid worker