Force PowerShell Module Path Variable in Existing Session

Q: I updated the PowerShell module path, but how can I make it take effect in my current PowerShell session?

A: To force an update to the module path in an existing PowerShell session, run the following code:

$env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath","Machine")
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.