I'm having some trouble with PowerShell 7 in my organization. My Documents folder is redirected to a UNC path, and since I installed several modules, everything has become really sluggish. In PowerShell 5, I was able to change the base directory where PowerShell organized folders for storing help files, modules, and so on. However, it seems this isn't effective in PowerShell 7.
I've set the environment variable PSModulePath to C:usersmyuser.pwshModules for my user, but the system environment still includes the usual Program Files and System32 paths. When I start pwsh.exe, I notice that $env:PSModulePath adds three paths on top of my settings:
- PowerShellModules
- C:Program FilesPowerShellModules
- C:Program FilesPowerShell7Modules
Is there any way to prevent PowerShell 7 from doing this and set my operations to be rooted at "~.pwsh"? I'm open to any workarounds!
5 Answers
Unfortunately, it seems like PS7 doesn't support changing that default path. You could keep your Documents folder as tidy as possible, but that's tricky with the way `Install-Module` targets that location for new modules. I suggest moving anything out of there to your local files whenever you update or install new modules.
You could check the global PowerShell config JSON and also look at the system-level environment variable to see if there's anything that can be adjusted.
This is a known issue with how PS7 handles module storage paths. There’s hope for resolution in the future, as outlined in [this blog](https://devblogs.microsoft.com/powershell/powershell-openssh-and-dsc-team-investments-for-2026/#psusercontentpath-relocation). For now, there isn't a native solution to change this behavior, but you can install modules with the scope set to AllUsers to avoid some issues.
Another method is to save your modules in a different location and add that path to your module path. I use `C:ReposInfrastructureModules;` for all my essential modules. This way, as long as I'm on my management machine, I can sync my Git repo and have access to everything I need. Unfortunately, it looks like the root path will be fixed for now, and changing it would be a big deal.
Try using `get-help psmodulepath` and take a peek at the registry settings at the bottom. However, be aware that this often just appends paths instead of replacing them. Another option might be to create a symlink from a subdirectory at the end of your UNC path to a directory on your C drive, but this will need elevated permissions.

You can also use `save-module` to store your modules wherever you like. For updates, just run `save-module -force`. It’s not the best workaround, but it helps!