How can I change the default PowerShell module path away from OneDrive?
Asked by
CreativePineapple38
I'm really frustrated with where PowerShell modules are being stored by default. Why are they put in `%USERPROFILE%DocumentsPowerShell`? It seems illogical since that folder typically syncs with OneDrive, leading to unnecessary cloud storage use and version conflicts when I switch between different machines or architectures like ARM64 and AMD64. I mean, could you imagine if other package managers like NuGet or Winget did this? **What's the best way to change the default module path to a location that isn't influenced by OneDrive?**
Answers
If you donโt have local admin rights, consider creating a folder on a drive with plenty of space. You can use 'Save-Module' to place the necessary modules in subfolders there and load them from the designated path whenever you need. This is particularly useful if you want to stick with PowerShell 7.x while needing to switch between versions for specific modules.
Reply to this answer
Yeah, having OneDrive enabled by default is just ridiculous. It complicates things unnecessarily.
Reply to this answer
I think they should honestly use $env:LOCALAPPDATA for this sort of thing. It just makes more sense if you want to avoid cluttering your Documents folder.
Reply to this answer
A simple way to get around this is to just install the modules with the 'All Users' scope. This keeps everything in one accessible place and avoids the OneDrive syncing issues completely.
Reply to this answer
Honestly, isnโt the Documents folder the place for everything that isnโt media? Like, weโve had AppData structures forever, but it feels like Documents is the go-to place for so much else, including game saves and modules.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions