title: Using both desktop Powershell 5.1 and Powershell Core 6.1
body: <p>I was playing with PS.Core 6.1 in my VS Code - made it the default shell, opened PS debugging sessions with it, opened its console, etc ...</p>
  
  <p>Now I am opening the regular desktop Powershell 5.1 and get this:</p>
  
  <pre><code>Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  PS C:\Users\me&gt; get-module
  
  ModuleType Version    Name                                ExportedCommands
  ---------- -------    ----                                ----------------
  Manifest   6.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
  Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
  
  
  PS C:\Users\me&gt; $env:PSModulePath -split ';'
  C:\Users\me\Documents\PowerShell\Modules
  C:\Program Files\PowerShell\Modules
  c:\program files\powershell\6\Modules
  C:\Program Files\WindowsPowerShell\Modules
  C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
  PS C:\Users\me&gt;
  </code></pre>
  
  <p>This is not good. The PS.Core 6.1 installed its own <code>Microsoft.PowerShell.Utility</code> module which is incompatible with the desktop version. </p>
  
  <p>The PSModulePath environment variable now lists the PS.Core 6 modules alongside the desktop modules, even with higher priority. Even though I do not see it in the Control Panel:</p>
  
  <p><a href="https://i.stack.imgur.com/38xxt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/38xxt.png" alt="enter image description here"></a></p>
  
  <p>What a mess.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>The mess I observe is when I launch the shells from the shortcuts I have in the taskbar. The desktop one targets <strong>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</strong> and the core one - <strong>"C:\Program Files\PowerShell\6\pwsh.exe" -WorkingDirectory ~</strong></p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>So, somehow, either installation of PS.Core or my experimentation with VS.Code has updated the environment of the parent explorer.exe process. I describe it here - <a href="https://stackoverflow.com/questions/56888806/how-does-psmodulepath-environment-property-get-composed">How does PSModulePath environment property get composed?</a></p>
  
  <p>Could be a bug in the installation of PS.Core, which means it is a one time thing. Or a bug in VS Code, which means I could screw it again.</p>