I'm experiencing some frustrating problems with PowerShell after enabling Known Folder Move with OneDrive. It seems like PowerShell is getting confused and keeps trying to load modules from my user directory in Documents, which leads to failures with PowerShellGet. Even after deleting the PowerShell folder from my Documents, I still can't get it to use the system instance of PowerShellGet. I can only load it if I provide the direct path to the system version, and even then, some modules refuse to load properly. I really want to know if there's a fix for this. I'm using PowerShell 7, which usually works, but there are some modules that don't function in it. I even tried completely removing my user profile, and PowerShell works for a short time before breaking again. Any help would be appreciated!
4 Answers
You might want to take a look at your environment variables. It's possible that there's a rogue user variable for PSModulePath that's interfering with the system paths. This can happen if you're using certain services like EntraID sync, which are known to mess things up.
I've moved folders without any issues using both PowerShell 5.1 and 7.x, so I'm not sure what's going wrong for you. Have you checked if there's something specific in your PowerShell setup or environment that could be causing this? It shouldn't be an issue otherwise.
I haven't had issues with either PowerShell 5 or 7 myself. You mentioned this is a 'known issue'—can you share where you found that information? Maybe there’s something specific in those discussions that could help.

I checked the system environment variables and they're clean, but in PowerShell, the PSModulePath variable still shows both the system and user document paths. I could temporarily fix it by deleting the folder from Documents, but I still have to use the 'all users' scope for updates, or it breaks again.