Step 1: Make sure no Modern apps are running on your machine. You may reboot the system and then do it before running anything else. Launch an elevated command prompt (one with Administrator rights).
Step 2: Run the following command to take ownership of the WindowsApps folder (this is where Modern UI apps are installed by default).
takeown /F “C:\Program Files\WindowsApps” /A /R
TakeOwn
Step 3: The directory now needs to be copied (not moved) to the new target location, which I’ll take to be D:\WindowsApps. Run the following in Command Prompt:
robocopy “C:\Program Files\WindowsApps” “D:\WindowsApps” /E /COPYALL /DCOPY:DAT
Robocopy
Make sure that the copy action was successful and there were no errors or failure messages. If you face those, reboot the machine and start over.