Worth Corner, Crawley, RH10 7SL

Support Hours - Mon-Sat, 8.00-18.00

Welcome to our PowerShell blog

PowerShell has grown overthe years and become invaluable in the world of SQL Server and automation.

However, it has a quirky syntax and I tend to remember SQL better than anything else, therefore this is my blog to document what I learn as I go...


PowerShell Core ISE (Visual Studio Code)
Published: Oct 16, 2021
Now there’s a clue in the title on this one. There is no ISE for PowerShell Core. This is because the ISE was a Windows thing and the whole point of Core is that it’s Cross Platform and therefore they haven’t tried to build in a specific ISE that will work for all OS variants.
However, there’s always an alternative and we have one in the form of Visual Studio Code, our friendly cross platform multi-language supporting application.
Visual Studio Code is a standalone application for Source Code Editing and which works cross platform whether that be Linux, Windows, or macOS.

It was originally built to support Javascript but has extensions that allow you to code in it using a plethora of languages such as C#, Python, SQL and, of course, PowerShell.

This means that it effectively becomes the ISE for PowerShell Core. It’s not perfect by any means as there are still bugs and issues which mean that the true ISE is still better, but it’s pretty close for most people and their coding needs and with it being open source there is the option to submit bugs or suggestions if you have any, so it’ll only improve over time.

You can get it from here https://code.visualstudio.com/ and it’s easy to download and install as per any other application. It’s also pretty small as a file because it comes as a very basic editor and not much else.

Once you install and open it then you need to add your languages as Extensions. You do this from the Extensions menu in the application:


Then type PowerShell into the search box at the top of the submenu that appears, and you’re good to go with the top result as presented:


In my case you can see that I’ve already got the PowerShell extension installed (hence the star rather than the “Install” button) but you can see the button on the other extensions, therefore you just need click Install on the top result and it’ll add the extension.

Whilst here I’d advise adding SQL Server… just because… but that’s me :o)

Anyway, once installed you’ll see a new icon appear on the left-hand menu:


We’re now almost there… you can see that we’ve got the command list available, it’s starting to look like an ISE… but there’s one small flaw that took me a few seconds to realise.

I could not get it to allow me to use “New File” with the extension of my choice. It simply wouldn’t play nicely. I imagine there’s a way, but I can’t seem to work it out. Therefore I’ve one last piece of advice here… create a test file and just open that.

So let’s do that quickly…


All I’ve done is Right Click, new File, picked a Text File and then renamed it as .ps1

And that’s it, now you can open that file in Visual Studio Code and use it as your PowerShell Core ISE.

Happy coding.

Leave a Comment
Your email address will not be published. All fields are mandatory.
NB: Comments will only appear once they have been moderated.

SQL  World  CEO
Kevin  Urquhart

iPhone Selfie

I am a SQL Server DBA, Architect, Developer, Trainer, and CEO of SQL World. This is my blog in which I’m simply trying to share my SQL knowledge and experiences with the world.

Categories


© Copyright 2020 SQLTraining Ltd.