vscode slow

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.

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

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

My $.02

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

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.

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.


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

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


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


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…


[quote quote=272041]“test code in PS Core as opposed to Windows PowerShell”


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.

Here is how:

Open settings.json file which is located inside:



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.