title: How to prevent Powershell Modules being installed into OneDrive
body: <p>My <code>$env:PSModulePath</code> has ended up containing OneDrive:</p>
  
  <pre><code>C:\Users\jack\OneDrive\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
  </code></pre>
  
  <p>But I don't want all my Modules being synced to the cloud.</p>
  
  <p>According to the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_modules?view=powershell-7#module-and-dsc-resource-locations-and-psmodulepath" rel="noreferrer">docs</a>:</p>
  
  <blockquote>
    <p>The user-specific CurrentUser location on Windows is the PowerShell\Modules folder located in the <strong>Documents</strong> location in your user profile ... <strong>Microsoft OneDrive can also change the location of your Documents folder.</strong></p>
  </blockquote>
  
  <p>So that explains how the Modules ended up there. But how do I fix it?</p>
  
  <p>I can modify <code>$env:PSModulePath</code> but this will only allow pwsh to find more modules I think. It won't change the default path for installing new modules for <em>CurrentUser</em>.</p>
  
  <p>P.S. I face the same problem with the <code>Update-Help</code> when it saves help locally... OneDrive :-(</p>