Profile for VS Code / Powershell 1.9.0 extension / Powershell Core

Viewing 2 reply threads
  • Author
    Posts
    • #888064
      Ramon Tan
      Participant
      Member Points: 764
      Rank: 2

      I am beginning to use VS Code (in conjunction with Powershell 1.9.0 extension).

      I also installed Powershell Core 6.1 — on the understanding (please correct if

      this is wrong!) that VS Code will use Powershell Core 6.1 by default.

      In Powershell ISE, I had a simple “Login script” file named:

      Microsoft.PowershellISE_profile.ps1

      which automatically runs a few lines of PS code such as Set-Location,

      Set-RemoteExecutonPolicy, Get-content env:Psmodulepath, etc.. for my “environment”.

      My question is:

      Where would I put such a Login script in the VS Code/Powershell 1.9.0?

      I notice that Vs Code created two separate folders in my Documents folder:

      .\VS Code Powershell and .\VS Code Javascript.

      And what file name should I use?

      Would be grateful for any advice, tips or references.  Thanks in advance.

    • #888182
      Luc Fullenwarth
      Moderator
      Member Points: 16,126
      Rank: 4

      Hi Ramon,

      Whichever console you use, just type the following inside it,
      and you will get the path to all profile files.

      $Profile | Get-Member -MemberType NoteProperty

       

      avatar
      • #888204
        Ramon Tan
        Participant
        Member Points: 764
        Rank: 2

        Much appreciated, Mr Fullenwarth.

    • #888194
      Michael Pietroforte
      Keymaster
      Member Points: 37,150
      Author of the year 2018
      Rank: 4

      PowerShell ISE has its own profiles because it comes with an independent PowerShell host. On the other hand, Visual Code does not have its own host and can work with all PowerShell hosts that are available on your computer. I described in detail how PowerShell profiles work.

      If you installed PowerShell Core 6.1. then you can use VSCode as a console. You can also work with Windows PowerShell 5.1. I wrote about the topic here and here.

      avataravatar
      • #888200
        Ramon Tan
        Participant
        Member Points: 764
        Rank: 2

        Many thanks Mr Pietroforte, your earlier article on using VS Code with multiple shells was very informative and helpful.  Best,

        avataravatar
Viewing 2 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2022

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account