This is Part 2 of our series on Remedying Shell Shock. If you would like to read Part 1, you can do so here.
Last time, we covered an introduction of shells and how they can be used to automate IT processes. In this piece, we’ll focus specifically on the power of PowerShell.
What is PowerShell?
PowerShell was originally built and made to only run on Windows operating systems. Recently, however, it was opened up to the public for Mac and Linux systems as well. This is a huge benefit for admins — being able to use one tool across any OS makes life easier. The fact that the tool is PowerShell makes admin life better because of all the options out there, PowerShell is arguably by far the most capable and unique in its way of syntax, but also flexible on what you can write.
Whether you’re looking to get quick reports or status updates to full on automation,
PowerShell is one method to easily interact with any of your operating systems or other services, such as the JumpCloud Directory Platform.
PowerShell is an object oriented shell, meaning that each command you write is targeting a thing within the environment. Again, going back to our written English and grammar example from last time, you’re writing a sentence to describe or find the direct object.
For example, to list all available commands with the word Get in their name can be written like this:
Get-Command -Name *Get*
This would list all the PowerShell commands you can run by its Name containing the value Get.
So why PowerShell? Why not Bash or C Shell? Because PowerShell is native to Windows and has been opened up to Mac & Linux Systems as well, this opens the doors for possible areas to run shell scripts and commands.
There are hundreds if not thousands of possible commands within PowerShell that you can leverage for work, although remembering all them is next to impossible. There are many good cheat sheets across the web which go over the top most used PowerShell Commands to get you eased into using the command line. If you’re interested in a cheat sheet or another beginner’s guide to PowerShell, the authors over at Comparitech have written an amazing intro to PowerShell guide. Otherwise if you’re looking for a much more advanced and in-depth document and reference, Microsoft’s got you covered there too.
PowerShell and JumpCloud
Organizations using the JumpCloud Directory Platform can use PowerShell to manage and control their Windows, Mac, and Linux devices.
If you haven’t already, you’ll want to download and install the JumpCloud PowerShell Module for your current OS. Imagine the JumpCloud PowerShell Module as a plugin for PowerShell, allowing you to authenticate and interact with your JumpCloud tenant.
Another example using JumpCloud’s PowerShell Module, could be a simple command to see what all JumpCloud Commands are available using the same format above and type:
Get-Command -Name *JC*
This will output an easily legible table with all the available JumpCloud PowerShell commands that you can use to interact with your JumpCloud tenant.
Writing single line commands is great for doing quick queries or simple actions, but no good story or tale was written in a single line. By leveraging multiple lines, variables, and by combining simple singular lines together, you can now create massively powerful scripts.
Learn about these scripts and how to optimize them in the third and final part of this blog series.