HBoPS #1: Use a proper editor!

All thing begin at the editor. Or you know, right after you discovered something you want to automate :). So using an editor for writing PowerShell code that helps you develop better code is neat!

Not that I have any hate on Notepad, or even Notepad++, but for writing anything other than a very short script, I rely on something that helps me create better and faster!

What to look for?

When you’re looking to use an editor that provides you more functionality than Notepad, it’s fairly important to know what functionality Notepad does not provide:

  • Syntax highlighting: Notepad will not tell you when you write a cmdlet wrong
  • Collapse blocks: Handy when you can collapse regions, code blocs, or comments!
  • Clean indentation: This makes your code easier to read. Sure you can do this with notepad manually, but it’s a pain…
  • Line numbers: Nothing like getting an error in your 1000+ line script and having to count lines in notepad…
  • Auto complete: Most editors focused on PowerShell will offer you the Auto complete. This saves you time, and reduces the possibility of creating a ‘spelling mistake ‘ in a cmdlet or its parameters.

Which editor to use?!

Let’s face it… If you go randomly looking at editors which exist on the internet, you’ll find more than you know what to do with. 

PowerShell ISE

The default editor for PowerShell scripts, modules, and all things related… For the longest time this has been the official editor from Microsoft. It’s installed by default on Windows platforms, and is a handy tool to start with. Unfortunately it does not support Powershell Core, nor is it cross-platform, so it has been replaced by Visual Studio Code as the official editor.

Visual Studio Code

As I just mentioned, this is the new ‘Official’ PowerShell editor from Microsoft. It’s free, cross-platform, and has a lot of features. I haven’t really worked with it, but with all the rave from my peers, I’m going to give it a whirl, just to see what it is about. 

Mike Frobbins has  an (older) post on how to configure Visual Studio code for PowerShell development: https://mikefrobbins.com/2017/08/24/how-to-install-visual-studio-code-and-configure-it-as-a-replacement-for-the-powershell-ise/

Visual Studio

I’ve been using Visual Studio as my main way for PowerShell dev work for a long, long time. It’s a bit overpowered for just this, but with the PowerShell Tools plug-in, it’s a mighty beast indeed!

Other editors

There are many more editors out there, paid and free. I’ve never used them, so I can’t pass judgement upon their poor souls:

  • PowerShell studio from SAPIEN (https://www.sapien.com/software/powershell_studio)
  • OmniShell from epiccoders (https://omnishell.epiccoders.com/)
  •  ISE Steroids for Powershell ISE (http://www.powertheshell.com/isesteroids/)

Whatever your flavor, I’m sure you’ll find it!

Index:
HBoPS #1: Use a proper editor!
HBoPS #2: Error handling and you!
HBoPS #3: Avoid using Write-Host (and save puppies!)
HBoPS #4: Variables, Parameters, and Battlestar Galactica
HBoPS #5: Reduce, Reuse, Recycle
HBoPS #6: Handling Credentials

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu
%d bloggers like this: