PowerShell for Programmers: A Quick Start Guide

The new landing page for this series will be here.

Learning PowerShell can be very useful for people with programming experience. Whether you’re currently a developer, dev-ops, or an admin you can get some serious use out of being familiar with PowerShell. You might think its just a version of command prompt with an eye-burning color scheme, but it really is a full scripting language with lots of nice tie ins.

PowerShell is geared towards IT admins and made easy to learn with lots of nice shortcuts, and auto-complete. Unfortunately a lot of those shortcuts might lead to some issues for programmers who are just kind of winging it, and I wanted to write this series to help clear up some of those issues I see the most often.

Who is this series for?

People with general programming knowledge (C, C++, C#, Java, Perl, Python, etc) who are looking to pick up PowerShell.

I’m going to assume you understand lots of programming concepts already, including things like:

  • Variables
  • Object models
  • Flow Control (loops, if statements, switch statements)
  • Writing and using functions with arguments

I'm going to cover some of the quirks of PowerShell to help you pick up the language, avoid making mistakes or doing extra work, and get scripting quickly. Let me know if there are topics you’d like to see added.

If you find this helpful don't forget to rate, comment and share 🙂

I'm aiming to write a post every 2 weeks or so to start. I’ll keep this post updated with links to the different parts of the series as they come out.

  1. Basic Syntax – CMDLETS
  2. Basic Syntax – Variables, Objects, and Data Types 
  3. What happened to my operators? (==,!=, >=, etc)
  4. How to write function the right way
  5. Double quotes, single quotes, and other quirks with strings
    • Here Strings
  6. Let the switch statement do some extra work for you! 
Comments (13)

  1. Lennart says:

    I definitly would like to see how to work with strings. Comparisons, single/double quotes, modification etc. Best would be some parallel code in C# to show equivalent functionalities

    1. Kory T says:

      I’m aiming to post every other week or so on this, so I think I’ll get to the string stuff at the end of Feb or March. I’ll keep that in mind and post some parallel code in some instances!

    2. Kory T says:

      Just wanted to let you know, one of the posts covers comparison operators and the post on strings and quote characters should be up this thursday (3/1). Happy coding!

  2. Good guide 👍🏽
    Waiting for more… 😃

    1. Kory T says:

      Glad you’re enjoying it so far 🙂

  3. Void says:

    Very helpful guide. Super useful for someone used to programming in other high level object oriented languages but new to sysadmin.

    1. Kory T says:

      Glad you’re enjoying it so far 🙂

  4. Bill Costa says:

    After almost 40 years as a coder, I’ve learned (and thrown away) at least a dozen programming languages. I was looking for a book on PowerShell that was aimed at experienced coders. No luck there (if you known any, please mention it here). In the meantime I went through all of your articles posted to date, and these have been very helpful in giving me a quick boost into PowerShell. Looking forward to the “Doing more with functions” and “Here Strings”.

    As for PowerShell itself, I’m really impressed with this language. I can see where it has liberally stolen ideas from a number of other languages, and that’s a good thing! But the idea of piping objects rather than dumb text strings is absolutely brilliant. Now that PowerShell Core is available for Unix and Mac, I think I’ll be able to start using it in places where I would have normally used Bash. The one gripe I have at this point is that, when read code from a file (as verses interactively from the command line), the language should have required ‘;’ separators for all statements. The rules for when PowerShell will *guess* that a statement is complete can be tricky, and using the backtick (`) as a line continuation character is not wonderful because it is so small and can be easy to miss when quickly scanning the code.

    1. Kory T says:

      Glad you’re enjoying it Bill!

      I like not having to use ; separators most of the time, but I also hate backticking. I’ll do a short post sometime talking about some line break rules that might help you find a good balance 🙂

  5. Steven John says:

    Thanks for guiding keeping sharing these kind of posts

    1. Kory T says:

      Glad you’re enjoying it so far!

  6. Lingjing2014 says:

    Thank you for writing the blogs! They are exactly what I’m looking for:)

    1. Kory T says:

      Glad you’re enjoying it!

Skip to main content