How can I change the default PowerShell module path away from OneDrive?

0
78
Asked By CreativePineapple38 On

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?**

5 Answers

Answered By ChillTechnerd On

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.

Answered By ScriptingGuru77 On

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.

Answered By CloudyAreaw55 On

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.

Answered By PowerShellPal99 On

Yeah, having OneDrive enabled by default is just ridiculous. It complicates things unnecessarily.

Answered By TechWhizZone42 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.