Hanging on Get the user profile - ConvertTo-NTAccountorSID

I am receiving strange behaviour on Windows 10 machines. The script hangs on the line:

[Post-Installation] :: Get the User Profile Path, User Account SID, and the User Account Name for all users that log onto the machine.

The log line ConvertTo-NTAccountorSID runs for over 20 minutes on some user accounts and some of my deploys are taking a couple of hours when on the older version of the toolkit (3.6.) were taking minutes.

Can you give us more details? Get-UserProfiles has a lot of loops that can cause long execution on some machines.