Move Over ISE, Time To Try VS Code
Our resident PowerShell expert, Neil Fraser has been researching alternatives to the PowerShell Integrated Scripting Environment (ISE). He took a close look at Visual Studio, PowerShell Studio and VS Code to see if any of them measured up to the ISE, here’s what he found…
The PowerShell ISE
If you keep an eye on the AgileCadence blog, you’ll know that we’re fans of Microsoft’s task automation and configuration management framework, PowerShell. With DevOps at the core of everything that we do, PowerShell helps us to automate repetitive and time consuming tasks, saving valuable time and resources.
The PowerShell ISE is the default editor that comes pre-installed with Windows. It is a basic editor that allows the user to run commands and create, modify, de-bug and test scripts. It’s intuitive to use and lets you start scripting instantly. So far, so good. But when we were speaking with Jason Helmick at this year’s Global PowerShell Summit he advised us to look at alternatives if we wanted to get the best out of PowerShell module development. So we set to work and investigated 3 options:
Visual Studio
PowerShell Studio
VS Code
– Visual Studio
Visual Studio has PowerShell Tools that can be installed, however Visual Studio is quite a hefty installation and the full development environment felt over the top for scripting, and frankly didn’t work as well as the ISE.
– PowerShell Studio
PowerShell Studio by Sapien Technology: Comes with a reasonably large price tag, however was great to use and instantly felt like a step-up from the ISE. I evaluated it with a free trial licence and enjoyed the scripting experience which is targeted at ‘Windows PowerShell’. However it fell short when scripting across various sites. If you need to be scripting on many machines (which happens when working on remote client sites with processes that you cannot simulate from your own laptop), a two machine licence, with non Microsoft installation media, is very restrictive. So this editor was removed from my short list.
– VS Code
This left VS Code to try which I had noticed was increasingly the editor of choice at the PowerShell summit. It is free and a Microsoft product. However I found VS Code frustrating to use, it wasn’t intuitive and with mounting pressure from imminent deadlines I ditched the trial and went back to the ISE to complete my project at the time.
Fast Forward Six Months
VS Code was still on my mind. I knew I would need to make the switch eventually since PowerShell Core is not compatible with the ISE, but I was struggling to find the time to invest in making the switch. But then the new telemetry project we are working on needed some PowerShell to control Linux compute sticks. Linux = PowerShell Core, which meant time to try VS Code again. To set this up I did the following:
- Downloaded and installed VS Code
- Installed the ‘PowerShell’ extension
- Installed ‘Cobalt2 Theme’ extension to make it look pretty
- Added the following settings:
“files.defaultLanguage”: “powershell”,
“powershell.integratedConsole.focusConsoleOnExecute”: false,
I started scripting and was blown away by how much VS Code had moved forward as a PowerShell editor in such a short space of time. Here are the best bits:
- The IntelliSense is great
- Integration with our GIT Repositories is seamless
- Code folding now works well (note: the folding is based on indentation not from parsing the PowerShell, but turn on auto formatting and not only are your scripts easier to read but all the folding is in the correct places)
- Opening a Folder allows you to navigate between files very easily
- The shortcut keys take a bit of learning, but are powerful and speed up your working
- A plethora of extensions both improve PowerShell scripting and make VS Code the editor of choice for many other applications
- VS Code is constantly being updated and improved
If you have not used VS Code recently I would strongly suggest you give the latest version a try. Now I’ve made the change I will not be going back.
What’s next?
Next on the agenda is to write a PowerShell script to install and setup VS Code with the aim of getting my colleagues up and running quickly… watch this space.