# Powershell installing modules into OneDrive folder

**URL:** <https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018>\
**Category:** PowerShell Help\
**Created:** [July 28, 2022, 8:44pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018 "2022-07-28T20:44:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_S](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Gabriel\_S](https://forums.powershell.org/u/Gabriel_S)\
**Post date:** [July 28, 2022, 8:44pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018/1 "2022-07-28T20:44:02Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 28, 2022, 8:48pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018/2 "2022-07-28T20:48:29Z")

</div>

Gabriel,  
Welcome to the forum. 👋🏽

> [@Gabriel\_S](#):
>
> How do i prevent this from happening?

… by providing the `-Scope AllUsers` instead of `-Scope CurrentUser` when using `Install-Module`

> [@Gabriel\_S](#):
>
> I checked the PSModulePath environmental variable and it doesn’t contain a OneDrive location.

… but I’d bet it contains your profile path, doesn’t it? And that will be redirected and synchronized with your OneDrive folder.

---

<div class="post-metadata">

**Author:** ![Gabriel\_S](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Gabriel\_S](https://forums.powershell.org/u/Gabriel_S)\
**Post date:** [July 28, 2022, 9:02pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018/3 "2022-07-28T21:02:54Z")

</div>

Hi Olaf,

No, the env variable doesn’t contain any profile path, see the screenshot:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/7/7eacafa8b5902efcf538e080ed4dc4c81e77bcb5.png)

I will try with -Scope AllUsers next time, thanks for the suggestion. Does it work for Update-Module too?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 28, 2022, 9:26pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018/4 "2022-07-28T21:26:12Z")

</div>

> [@Gabriel\_S](#):
>
> Does it work for Update-Module too?

I’d expect that an installed module will be updated in the folder it’s installed in.

> [@Gabriel\_S](#):
>
> No, the env variable doesn’t contain any profile path

I actually wasn’t sure about that … I should have checked before. Sorry.

> [@Gabriel\_S](#):
>
> I will try with -Scope AllUsers next time

👍🏽

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:17pm UTC](https://forums.powershell.org/t/powershell-installing-modules-into-onedrive-folder/20018/5 "2024-05-16T20:17:41Z")

</div>


