PowerShell: Why should I learn it? Where do I start?

by | Last updated 2023.05.15 | Published on 2018.09.21 | Blog | 0 comments

Why should I learn PowerShell?

  • Microsoft, Linux, Unix, Solaris, Android, iOS – Operating Systems that run our planet.
  • Computers, Phones, Cameras, MediaPlayers, BlueRay players, Set top boxes, Alarm Systems, IoT – Some of the devices that we have that use these Operating Systems.
  • Shell, Bash, KornShell, Command Prompt, GUIs, PowerShell – Some of the interfaces that these devices have.
  • Batchfile, Shell Script, VisualBasic Script, PowerShell Script – Some of the powerful tools and methods that we can use to interact with not just a single device, but multiple, and at scale.

PowerShell is a TOOL. A tool that Microsoft has created that goes past the old ways of ‘scripts’ vs ‘GUIs’. The old way was that you used one or the other. Usually the GUI for managing a single or a handful of systems, and a script to scale it out to multiple systems. PowerShell has changed this. PowerShell has been combined to manage both, usually without the admin even noticing! Exchange Admin Center, and even the newest Windows Admin Center that was released in April 2018 are all GUIs over PowerShell.

Why should you learn PowerShell? Because it’s here to stay as an AWESOME tool that doesn’t just work on Windows, but also on Linux thanks to Microsoft Open Sourcing it. What does that mean? If you use Linux in your environment, you can install PowerShell on Linux and use the same commands to build scripts that will work on Linux systems as well as Windows systems. That’s 1 method that works cross-platform.

Where Do I Start?

You must start at the beginning. This may sound obvious, but it is often overlooked. You need to start by doing. Start small. VERY small. Something that you do every day on your own computer or on a remote system – Something as simple as kill a task, or find out if a task is running, gracefully shut it down, and if it’s not responding after 10 seconds, kill it. Start there. I started with Exchange 2007 management. To this day I still use a cmdlet.txt file that I copy/paste from for exchange management. I can write the commands from scratch, but it’s easier to copy/paste. I’ve turned some of them into functions but usually in the environments I’ve worked in, it’s usually one-offs as when you’ve got a well-running system there may be very little change.

Don’t use PowerShell on its own – use PowerShell ISE (Integrated Scripting Environment) where it will actually do a lot more for learning and developing. As you type, it will pop up suggestions and help you start learning PowerShell.

Below is a set of commands that will help you in so many scenarios it’s not funny. Jeffrey Snover did a really great job with PowerShell… I wish I could have met him at the MVP Summit back in March (it was my first MVP Summit, so I stayed on track – but I plan on going to the next MVP Summit in March 2019 and I will take one of his sessions).

Get-Command *process* = this will look for any command with the word process in it and return it with all verbs you can use with it.

Get-Process | Get-Member = this will get what properties and methods that you can do with Get-Process

$(Get-Process).<PROPERTY> = using Get-Member above you can find that there is an AliasProperty of ‘Name’ to ‘ProcessName’ so you can use $(Get-Process).Name and it will give you all the names of all the processes it returns. The $() performs the command inside and returns the result object so that you can act on it (in this case, doing a property call of .Name)

$(Get-Process).Name.Split() = another round of .<METHOD/PROPERTY>

Two Last Take-Aways

  1. Always remember – Tab completion is your friend.
  2. Shortcuts and aliases are for one-off PowerShell lines (Find out by typing ‘alias’ in Powershell)… DON’T use them in your scripts – use the long form (eg. gci is short for Get-ChildItem…. With Tab-Completion writing it out long-hand is 2 extra characters and a tab key… and is MUCH more human readable and self-documenting).

Latest Blogs

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

How Long Does WAM Take to Clean WSUS?

How Long Does WAM Take to Clean WSUS?

On most new systems, WAM can clean WSUS in under 72 hours; however, older systems with slower processing power could take longer. Older hardware—especially systems between 2010 and 2012—can slow down when it comes to removing obsolete updates. While many systems will...

WSUS Best Practices for New System Admins

WSUS Best Practices for New System Admins

New system administrators will have a varying degree of familiarity with WSUS. Some might have helped with Windows server admin tasks in previous roles while others might be learning everything on the job. When it comes to WSUS best practices, there is nothing more...

Frustrated with WSUS Errors?

Frustrated with WSUS Errors?

When using your WSUS server, there are hundreds of possible errors you could encounter. Investigating WSUS errors and possible solutions can take up an enormous amount of your time, whether it’s through trial-and-error or searching forum articles on fixes for your...