If your Windows PowerShell profile is inside your OneDrive folder and you don’t like that, this is what you have to do:
- open the Registry Editor
- navigate to HKEY_CURRENT_USER, SOFTWARE, Microsoft, Windows, CurrentVersion, Explorer, User Shell Folders
- change the Personal key's value
In this example, the old value of the Personal folder was C:\Users\ngeor\OneDrive\Documents. This is what Windows PowerShell uses to determine where the profile should live. Changing this to the non-OneDrive old school “My Documents” folder (C:\Users\ngeor\Documents in my case) works for PowerShell too.
Of course, the impact is that all applications will now think that the OneDrive location is not the default, so be aware of that.