The built-in 'Move Home Directory' action can fail on large directories if the operation takes more than 10 minutes to complete. This PowerShell code works around this issue by creating a separate process to move a home folder.
The script moves a user's home folder to another location. Unlike the built-in Move home folder action, it does not stop when unable to move a folder or file, and copies it instead. All locked items are listed in the Execution Log.
Example: if a Microsoft 365 (Office 365) tenant has only the Exchange Online and Sharepoint Online services enabled in the Enterprise E3 license plan, a user will have only these services enabled in the license after running script on them.