vscode slow

Welcome Forums General PowerShell Q&A vscode slow

Viewing 7 reply threads
  • Author
    Posts
    • #270787
      Participant
      Topics: 33
      Replies: 64
      Points: 224
      Rank: Participant

      the following command takes less than a second in powershell ise but takes 63 seconds in vscode.

      Get-DnsServerResourceRecord -RRType A -ComputerName domain.com -ZoneName domain.com | Where-Object {$_.recorddata.ipv4address -like $ip} | Select-Object -ExpandProperty hostname

       

      why would that be? also i couldn’t find a place to search this website for previous posts about vscode.

    • #270823
      Participant
      Topics: 9
      Replies: 170
      Points: 836
      Helping Hand
      Rank: Major Contributor

      This does not surprise me. VSCode is typical M$ bloatware 🙂

      Just have a look at all the options you can configure for VSCode … a nightmare.

      My $.02

    • #270832
      Participant
      Topics: 33
      Replies: 64
      Points: 224
      Rank: Participant

      ok. what’s my best option for scripting with powershell 6/7?

    • #270838
      Participant
      Topics: 9
      Replies: 170
      Points: 836
      Helping Hand
      Rank: Major Contributor

      I am the wrong guy to answer that question. Sorry. I do everything from a shell. Bad habit learned from spending too much time in Linux.

      I edit with VI and test/debug from shells. VI is by far and away the most powerful editor for coders there is. You can even use the VI extension in VSCode and get BOTH worlds, VI and Intellisense.

    • #272023
      Participant
      Topics: 2
      Replies: 5
      Points: 55
      Rank: Member

      This does not surprise me. VSCode is typical M$ bloatware

      VSCode is the best editor for PowerShell one can get, suggesting to not using it is at best funny…

      First of all, for your information, VSCode does not run your code to make something run slow.

      Why is the command slow in this specific case, the answer could be in integrated shell which is by default PS Core.

      It could be PS Core is having issues and not VSCode, I would suggest to test code in PS Core as opposed to Windows PowerShell and then make some judgements.

      And if that makes any sense, VSCode can be configured to use Windows PowerShell instead of PS Core.

       

    • #272035
      Participant
      Topics: 9
      Replies: 170
      Points: 836
      Helping Hand
      Rank: Major Contributor

      I never suggested NOT to use it. I simply said I don’t. Get your facts straight.

    • #272041
      Participant
      Topics: 33
      Replies: 64
      Points: 224
      Rank: Participant

      “test code in PS Core as opposed to Windows PowerShell”

      how?

      “VSCode can be configured to use Windows PowerShell instead of PS Core”

      how?

    • #272773
      Participant
      Topics: 2
      Replies: 5
      Points: 55
      Rank: Member

      I’m posting this reply for the third time because trying to post it again results in “duplicate detected, it appears you already said that”

       

      Trying again…

       

      “test code in PS Core as opposed to Windows PowerShell”

      how?

      Simply run your script with Windows PowerShell and then run it with PS Core.

      If you see any difference in execution speed you know what’s the problem.

      “VSCode can be configured to use Windows PowerShell instead of PS Core”

      how?

      Here is how:

      Open settings.json file which is located inside:

      C:\Users\YOUR_USERNAME\AppData\Roaming\Code\User\settings.json

       

      Insert following lines into this file:

          “terminal.integrated.shell.windows”: “C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe”,
          “powershell.integratedConsole.showOnStartup”: false
      If there already are these values update them instead.
      Restart VSCode.
      Run your code and try to reproduce the problem.
      Alternatively you can select default shell as shown in the screenshot below:
      Run your code in the selected shell.
      powershell means you’re using Windows PowerShell
      pwsh means you’re using PowerShell Core
      Third option is to install latest version of PowerShell core and set it’s path inside settings.json as shown in first step.
Viewing 7 reply threads
  • You must be logged in to reply to this topic.