I noticed that Powershell 7.2.5 installs its modules and other scripts into my OneDrive folder, specifically C:\Users\myuser\OneDrive\Documents\PowerShell. This is undesirable, as the subfolder can become quite large and can take up the majority of my OneDrive space.
How do i prevent this from happening? I checked the PSModulePath environmental variable and it doesn’t contain a OneDrive location.
Welcome to the forum.
… by providing the
-Scope AllUsers instead of
-Scope CurrentUser when using
… but I’d bet it contains your profile path, doesn’t it? And that will be redirected and synchronized with your OneDrive folder.
No, the env variable doesn’t contain any profile path, see the screenshot:
I will try with -Scope AllUsers next time, thanks for the suggestion. Does it work for Update-Module too?
I’d expect that an installed module will be updated in the folder it’s installed in.
I actually wasn’t sure about that … I should have checked before. Sorry.