Useful Tools for SysAdmin Scripting (Part I)

Share

In this brief article, we’re going to take a look at some of the most useful tools for sysadmin scripting. As this is actually a fairly big topic to cover, in this first instalment, we’ll review some of the most efficient code editors when it comes to writing scripts.

Although we will touch on several editors, in general on this blog, we tend to lean more towards PowerShell, as its the tool that we use for the majority of tasks.

But this is one of those tricky subjects. Conversations like this tend to start with a fairly relaxed discussion about usability and features before erupting into a fierce debate about which editor is the best, the worst or just a pile of garbage.

If you’ve never been involved in one of these debates first-hand, count yourself lucky. But if you’re curious, check out this clip from the series Silicon Valley. They’re not debating here code editors here (apart from the brief reference to Vi and Emacs); they’re debating spaces vs tabs, but this is another contentious topic amongst developers.

In this article, we’re going to start by just listing some popular editors. We’ll save it for the next article to talk about the other kinds of tools that can make life easier for sysadmins working with scripts.

 

The Most Efficient Code Editors for Scripting

 

Vi

If you come from the UNIX world (or GNU/Linux), this editor will already be very familiar to you. Vi (Visual) and its improved graphic interface version, gVim, are long-standing, highly-rated text editors.

It was first released under a BSD licence 46 years ago, in 1976, by Billy Joy, a developer working mainly with C, which was and still is one of the most widely used programming languages in the world.

GVim, on the other hand, is a version with a graphic interface and loads of utilities developed for Windows (and other platforms). You can download it from the GVim website.

This text editor offers search, substitute and syntax highlighting functions and many other features besides, including custom screensavers with various patterns.

If you’d like to learn how to use it, check out this website, where you can see all the different commands.

Personally, I’ve been using this editor for more than 15 years, and one of the big advantages is that you work in exactly the same way regardless of the platform you’re using.

 

Image - Editing screen in GVim
Image – Editing screen in GVim

 

Emacs

The text editor that has your fingers playing Twister! Emacs has a reputation for being really tough to get started with, and whilst it’s true that it’s quite arduous in the beginning, once you get used to it, it becomes a really powerful tool.

I still remember how traumatic it was the first time I used Emacs, and that was more than 20 years ago!

Emacs was developed by Richard Stallman, founder of the GNU project, which spawned other great projects like GNU/Linux and Apache. It was released in 1976 under a General Public Licence (GPL).

The big advantage with Emacs is basically the same as with Vi (gVim), which is that you can work in exactly the same way on any platform. However, if you think Vi is complicated at first, Emacs is frankly hellish.

The first few times you use the program tend to be very disorientating, but once you’ve learnt a few basics, it’s one of the most powerful editors by a long way.

To download the program for Windows, check out the GNU Emacs website, where you’ll find instructions for installing it on various operating systems, including GNU/Linux, BSD, MacOS and Windows. You’ll also find plenty of manuals too.

 

Nano

Another option for people who prefer GNU/Linux or UNIX is Nano. Nano is what we might call a traditional text editor, but it’s much simpler to use than Vi, without saying anything about Emacs.

Nano is programmed in C and was based on Pico. It was released under a GPL in 1999 and has been adopted by countless administrators due to its ease of use and the fact that it’s free.

The software doesn’t offer many of the benefits that you can find with Vi or Emacs, but it does allow quick, flexible editing.

If you’d like to try it out or use it on Microsoft Windows, you can download it from the Nano Editor website.

Just like gVim or Emacs, you can get much more out of this program by using shortcuts. Check out this link to see them for yourself!

 

Notepad++:

At last, we come to an editor that it’s UNIX-based, although it was originally developed as opensource and is available under a GPLDeveloped in C++ and released in 2003, it was designed to be used on Windows as a text editor with syntax highlighting for source code.

Unlike the other editors above, Notepad++ isn’t native to GNU/Linux. If you want to use it on this platform, you have to first install WINE, a compatibility layer that allows you to run Windows or DOS applications on GNU/Linux.

If you want to install Notepad++, visit the downloads page on the Notepad++ website.

One of the big advantages of Notepad++ when compared to the other editors so far is its simplicity. There are some special modes and key combinations that can make things more efficient, but to be honest, they’re not really necessary as there’s a wonderful menu bar that you can use to perform all sorts of tasks.

The other wonderful thing about this editor, at least for me, is that it allows you to open countless tabs to have everything you need to hand. And also, if the device shuts down or you accidentally close the application, everything will still be there again when you restart.

 

PowerShell ISE

PowerShell ISE or (Integrated Scripting Environment) is a Windows native application that was designed to develop and run PowerShell scripts.

You can work with it in two different ways:

  • You can either use the classic command format of PowerShell as if you were using a command prompt.
  • Or you can work as you would traditionally work with an IDE.

When we say the traditional way of working with an IDE< we mean that when writing code, the program will suggest autocomplete options, correct syntax errors and even allow you to test sections of code.

This is the first editor in this list to offer all these features, but that makes sense as it’s native to Microsoft.

All these features can be really useful when scripting and, once you get used to the environment, which doesn’t take long, it can really improve your efficiency.

Because it’s a native application, you don’t need to download or install it. All you need to do is run the PowerShell_ISA command or go to “C:\windows\system32\” to launch the program manually (%windir%\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe).

 

Image - Example of autocomplete in PowerShell ISE
Image – Example of autocomplete in PowerShell ISE

 

Sapien PowerShell Studio

PowerShell Studio is an IDE developed by Sapien Technologies Inc. The most recent version was released in 2023 and supports all versions of PowerShell.

PowerShell Studio is a very complete solution with all the usual features of an IDE, such as syntax marking with colours, autocomplete options, error correction, step-through execution, etc.

FIt also offers many other features like packaging, integration with Git and a file recovery feature to prevent data loss.

Overall, it’s a very good option, but there’s a big “but”; what I don’t like about this editor is that you have to pay for it. There is a monthly ($25), annual ($250) or lifetime ($450) subscription, but when it comes to paying for an IDE, I have a clear preference, which is Visual Code.

If you’d like to download the trial version of IDE or even buy the full version, visit this page.

Similarly, if you’d like to learn more about this editor, check out the PowerShell Studio Manual.

 

Image - Code Edit Screen in PowerShell Studio
Image – Code Edit Screen in PowerShell Studio

 

Visual Studio Code

Visual Studio Code is a free, opensource editor (MIT licence) developed by Microsoft and released in 2015. It’s very popular amongst all kinds of developers, including PowerShell script developers.

Aside from the fact that it’s free and opensource, this editor also has a strong supporting community (as do many of the other editors that we’ve looked at), and there are also a large number of extensions on offer. Furthermore, it’s been developed to integrate perfectly with Git.

It supports a lot of languages, and it also includes features like syntax markingcommand autocomplete and a code corrector (not available for all languages).

Something else that I find particularly interesting is that this editor used a lot in training courses, such as official Microsoft courses, professional training centres or graduate and post-graduate university courses. So, it’s quite possible that you’ve already come across this editor before.

You can download the installer from the Visual Studio Code website, where you’ll also find supporting documentation, forums, extensions and much more.

Without a doubt, this is the best option if you want a powerful, flexible, free editor that supports a wide range of languages.

 

Image - Edit screen in Visual Studio Code
Image – Edit screen in Visual Studio Code

 

Visual Studio Professional

Visual Studio Professional is the professional version of Visual Studio Code, and it can be run on either Windows or MacOS. It was developed by Microsoft using C++ and C# and was first released in 1997 in a proprietary format.

NOTE: While there are versions for Windows and MacOS, there is unfortunately no version for GNU/Linux. For GNU/Linux, you’ll have to settle for Visual Studio Code.

This editor includes all the features that Code offers but with a large number of improvements, such as Azure credit and support for Azure DevOps.

This is a completely different beast, both in terms of features and costs, which are really quite high.

A monthly usage licence costs $45 for the professional version and the Enterprise version costs $250. Both come with a basic Azure DevOps plan but Enterprise also includes a test plan. You can see the conditions of the Enterprise agreement here.

 

Summary

As you can see, there are several options to choose from when scripting, some with more features than others, but it really just depends on what you’re looking for.

You might just be looking for an editor that allows you to work with different types of code and offers syntax detection. On the other hand, you might want to have everything integrated into a single interface, allowing you to edit, compile, etc., work with multiple languages and not have to constantly jump between tools.

Personally, I would opt for something like Vi or Emacs that allows you to have the same experience on different systems, but I have to acknowledge that something like Notepad++ or even an IDE like Microsoft’s ISE would be much simpler to use, without even considering the more powerful options like PowerShell Studio or Visual Studio.

But remember, the important thing is for you to find the right choice for you. This list is far from complete, and we’re sure that there are many other tools and utilities out there that we’ll touch on in future articles. In the meantime, you can read about the ones we’ve already talked about on our blog.

Thanks for reading!

Category:Sysadmin

Other posts that may interest you

18 de December de 2023
Our Remote Desktop service just keeps getting better! We’ve recently developed some new features to improve service security and
15 de December de 2023
On 22 November, the Jotelulu Roadshow 2023  finally came to a close after seven fantastic events in seven different
12 de September de 2023
Today, we’re going to tell you all about RAID. We’ll explain exactly what it is, take a look at the

Fill out the form and one of our Sales team will contact you soon.

growth@jotelulu.com  |  jotelulu.com 

You can unsubscribe from these communications at any time. For more information,  check our Privacy Policy.