My $env:PSModulePath
has ended up containing OneDrive:
C:\Users\jack\OneDrive\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
But I don't want all my Modules being synced to the cloud.
According to the docs:
The user-specific CurrentUser location on Windows is the PowerShell\Modules folder located in the Documents location in your user profile ... Microsoft OneDrive can also change the location of your Documents folder.
So that explains how the Modules ended up there. But how do I fix it?
I can modify $env:PSModulePath
but this will only allow pwsh to find more modules I think. It won't change the default path for installing new modules for CurrentUser.
P.S. I face the same problem with the Update-Help
when it saves help locally... OneDrive :-(
Perhaps the information in this thread on Reddit, could be of help.
Here's a snip from one of the answers, talking about excluding certain folders:
You can accomplish this by opening the OneDrive settings on your PC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With