I'm in the process of migrating a client from a file share to Microsoft 365. Part of the migration includes applying sensitivity labels. So far, we did an inventory and know what labels should be applied to which file.
What is the best way to apply labels at such a granular level? I tried using the Set-AIPFileLabel PowerShell cmdlet in a loop, but found it to be very unstable. It crashes over 50% of the time, taking down the entire PowerShell session. When it doesn't crash, it uses up a very large amount of memory that is not being released until the entire script ends.