You don’t know PowerShell

We’ve been doing a lot of interviewing at work of late. You see, we’re looking for good Windows DevOps candidates, and the local market is… well… let’s just say that next-gen Windows guys are a little thin on the ground around here.

This is a problem. Because while next-gen windows candidates are thin on the ground, resumés claiming next-gen Windows skills are emphatically not thin on the ground. In fact, I have actually – literally – lost count of the number of resumés I’ve seen where PowerShell is touted as a key skill, only for the candidate to fail some very simple PowerShell questions in the initial screening. So let’s just run through a few basic principles so that we don’t all waste each other’s time.

Principle one: If you do not know what the pipeline does, you do not know PowerShell

The pipeline is integral to how PowerShell works. If you don’t know what it does, this is a problem, because first of all you’re not going to understand half of what our existing codebase does, and secondly you’re going to write some horrible, inefficient and verbose code that will infuriate your colleagues and make you much less productive than you ought to be.

We like to joke that our developers sometimes “write PowerShell like a C# dev”, which is true. PowerShell is not C#, and the pipeline is a key differentiator. Sure, you can write PowerShell that looks a bit like C#, and it’ll work just fine, but if you want to use PowerShell every day, make it your business to learn about the pipeline and use it. Properly.

Pay especial attention to writing functions that accept pipeline input, because I ask about that in interviews. Or at least, it’s in my list of questions for later. I very rarely get that far.

Principle two: If you do not know how to make an HTTP request in PowerShell, you do not know PowerShell

We live in the era of the API. It’s incredibly difficult to get anything meaningful done in the modern, cloud-oriented, API-centric world of DevOps if you don’t know how to hit an HTTP endpoint from your chosen scripting language.

For the record, In a modern Cloud-oriented shop like ours, you’re going to be typing Invoke-WebRequest  and Invoke-RestMethod so often that I also expect you to know the built-in aliases for those two commands – and their parameters – from the get-go. After all, as employers we have a duty of care to prevent repetitive strain injuries.

HTTP is so integral to what a modern ops team does that frankly I’m appalled by anyone who fails this question. Even our Linux specialists know the answer to this. Seriously guys, come on.

Principle three: If you do not know how to use Get-Help, Get-Command and Get-Member, you do not know PowerShell.

PowerShell is internally documented. That means you don’t need to go off to Google to find an answer. You can find that out from within the PowerShell environment, using Get-Help.

The fact that it’s right within the environment also means you can even explore the system programatically. You can do a Get-Help on Get-Help or a Get-Command on Get-Member or a Get-Member on Get-Command and then Select-String on the pipeline for Parameters then drill into that that list for parameters of type CIMInstance or String or Object[] or whatever .

You literally never – NEVER – need a web browser to find out about PowerShell. Which is why, if you come for an interview and make it as far as a tech test, I check the browser history of the EC2 instance you do the test on, and if I find anything in there, you’ve basically failed.

Principle four: If you cannot describe the Verb-Noun naming convention within PowerShell, you do not know PowerShell.

In fact at this point I’m just going to go ahead and assume you’ve never written any PowerShell in your life, and you’ve only ever copy/pasted from Stack Overflow.


So, rant done, what should one do about this? Criticism is no use if you don’t make it constructive, and I’m not writing this to disparage anyone. I want to hire good people, and I also want you guys to be better at stuff. PowerShell is a joyously fun language sometimes, but if you don’t know it well, you won’t enjoy it. I want people who’ve flunked a PowerShell test to go away, fix their fundamentals then come back and blow us all away. Nothing would please me more.

So, what should a prospective candidate do to ensure they ace the PowerShell questions and end up writing Windows automation for one of Australia’s niftiest Continuous Delivery shops?

First things first: Get over to Microsoft Virtual Academy and do their PowerShell jump starts. Actually do them. Type along with the examples and get your hands dirty. Actually write some PowerShell code as you watch. Then once you’ve done the jumpstarts, watch the advanced sessions and maybe look into DSC.

Try interacting with some public APIs, drag down some data and play around with filtering it and persisting it out to JSON files, then pick up those JSON files from another script use the data to call other APIs. Grab some logfiles from somewhere and fiddle around with parsing them. Package your stuff up as a module. Try some DSC.

Above all else, don’t neglect the fundamentals and try not to rely on Stack Overflow or Google or ExpertSexChange for answers, because those answers might work, but they might also be wrong, or at the least inelegant. Seriously, when you spend all day writing PowerShell, you’ll be glad of the elegant option.

Oh, and one last tip: when I ask you what the most important Cmdlet in PowerShell is, don’t say New-ADUser or I might have you escorted out of the building by security.

 

 

6 replies on “You don’t know PowerShell”

  1. Arie H says:

    If only you were recruiting here…been looking for a few months now for a WinOps job.

    The market mostly looks for Linux guys and my former workplace was mainly a “silo” based so had to learn everything myself when it came to Linux, Jenkins, Ansible, on top of building a full CI/CD pipeline based on TFS/ReleaseManagement and PowerShell with the basic of DSC.

    So its some dependency on poplutaion. youre at what, about 1:10 vs USA..youre in good numbers..were at 1:4 🙂

    If moving to Europe wasn’t on my agenda, id definitely visiting my friends near Canberra 🙂

  2. Arie H says:

    edit: 1:4 vs Australia 🙂

  3. Dave says:

    I would argue Get-Help xxx -Detailed is the most important PowerShell command!

  4. SanityCheck says:

    — Reply Rant on —

    Warning, this is the longest response I have ever spent time doing. Folks will probably not read it all, but I was aiming at a point by point response. I am the world’s worst typist, well, sooo, you know.

    “if you want to use PowerShell every day, make it your business to learn about the pipeline and use it. Properly.”

    Pipeline (stdin and stdout as well as in DOS and other languages) in scripting is no new or news.
    Any one who has done any decent mid to advance .bat / .cmd should be familiar with. So, if you’d start there with your candidate interview, you’d have better context as to where they are coming from before driving at PoSH particulars.

    In DOS or PoSH, it’s just means; send this thing / stuff to that thing / use this in that. Other than that from a day to day perspective, the only other thing is to know, there are things you can use pipeline for or well, just won’t work as you’d like.

    As far as that ‘Properly’, can be subjective in many things. There are certain immutable truths for sure (like the performance gains pipeline engenders), but ‘Properly’ can just be one person take over the another. Much like the whole drawn out arguments regarding the use of the grave yard quote or back tick in PoSH coding for line continuation. I use it regularly, though many decry it’s use. So, again, outside of a few immutable, to each his / her own.

    Again, I am assuming here that this whole ‘Properly’ is in translation, what can and cannot be used in the pipeline.

    So, it would be more prudent that if you are going to complain that someone should now something to get to the next part of an interview loop with you and your org, that you do more than complain and pontificate; by making your pontification and then provide a complete valid resource validated example at both extremes. Simple to Advanced.

    “Principle two: If you do not know how to make an HTTP request in PowerShell, you do not know PowerShell”
    “For the record, In a modern Cloud-oriented shop like ours, you’re going to be typing Invoke-WebRequest and Invoke-RestMethod so often that I also expect you to know the built-in aliases”

    The number of people I still see using wget and crul.exe in PoSH still amazes me. So, one does not need Invoke-Webrequest / Invoke-RestMethod to do web stuff in PoSH. It’s just what you want in your operations and team. I an candidate comes from another team that do not use these but other methods like wget, curl or .NET directly; What difference doe sit make. They know how to do it. Now, if you hire them they need to use what you say, so they have to change. However, to eliminate them because they don’t use things the way you do for the same goal, well, you know.

    Alias use is great for cranking out code, but on delivering leaving your code that way if just not prudent. I use aliases regularly, but on delivery, I have a routine the expands not only the built-in aliases, but my custom ones as well. No one should have to spend unnecessary time trying to figure out your shorthand to take over or use your code. That is just arrogant.

    “and their parameters – from the get-go. After all, as employers we have a duty of care to prevent repetitive strain injuries.”

    The is little reason to memorize this. Using the PowerShell ISE the Command tab and all the needed particulars are there. This is true if you are using editors like VSCode or PowerShell Studio or PowerGUI. It’s point and click, then run or copy and paste from the command tab. All the tools you need are right in front of you. Why would ‘wrought memorization’ be a thing for you. Of course, the more you do something, muscle memory kicks in anyway. That comes with time. There are folks that just are not good at ‘wrought memorization’, it does not mean they cannot do the work. Again, the tools are free and in front of you. Again, I’d consider this pompous act by an interviewer. Just because you do it or can / has no bearing a candidate’s ability to code well.

    Also, you call out the two web Invokes but not Start-BitTransfer as part of your web coding practices. Are you really using the web invokes to download or the like for large data packages? Really!?

    “care to prevent repetitive strain injuries.”

    Relative to this, many constantly types code blocks. Why are you not encouraging using Snippets with all this alias or long form stuff; so, you only have to type the content your need?
    CRTL + J is your friend.
    Don’t retype if you don’t have to. No one odes paper math in business, that is what calculators and MS Excel are for.

    “Principle three: If you do not know how to use Get-Help, Get-Command and Get-Member, you do not know PowerShell.”

    Again, the PowerShell ISE with the command tab (SHow-Command from the PoSH console Host) is there specifically for this reason.
    Copy a command in the script pane, left click, press F1. Command and Get-Help all at once. Get-Member though we can get at it the same way, one does need to be aware of its use case and how to take its potential large output and get only the bits you need. However, again you give no example of how you use it or expect folks in your employ to.
    How about something along the line of. “On my team we are constantly having to do ‘X’ and don’t always know all the bits we need, so we use Get-Member to…..”

    “You literally never – NEVER – need a web browser to find out about PowerShell”

    Blanket statements are almost always wrong.
    Yes, there is a reason to use a browser to find out about PowerShell. The PowerShell help does not contain all the docs and particulars regarding the .NET Framework (every API in the framework and how to access them using PowerShell), SQL, Exchange, Lync / Skype, Azure, etc., etc.

    So, yes, unless you have the books physically laying around or the eBook/PDF on your phone/tablet/computer (but wait you need browser to get those…), then yes you will need a browser to find out how to use ‘X’ in PowerShell that is not in the help files offline. Secondly, downloading the help files is a static. These files change all the time as such you need to view the MS Online versions of the help files or run Update-Help -Force before you start doing anything in PoSH; or at a minimum get in the habit of using – Get-Help -Name Get-Command -Online, instead. Which does what, make a browser call to the Online information.

    “Principle four: If you cannot describe the Verb-Noun naming convention within PowerShell, you do not know PowerShell.”
    “In fact at this point I’m just going to go ahead and assume you’ve never written any PowerShell in your life, and you’ve only ever copy/pasted from Stack Overflow.”

    And that would be a wrong assumption.
    Like you said and did I. All the help files and cmdlet samples are right in front of you. So, if it’s there, they use it. Being able to describe it to use it is meaningless. Again, pompous interviewing.

    Many know how to use it, but may not be able to describe it. They do this in their daily Windows solution management without really knowing what this Verb-noun thing is. They see these as cmdlets, period, not verb-noun programmatic conventions. They don’t search for verb-noun conventions, they search for cmdlets, without realizing they are using verb-noun stuff. It does not make them any less skilled because they cannot describe it. I cannot describe my car engine parts, that does not prevent me from learning how to drive or driving it and being a good driver. If someone did not know the parts of a hammer. Once someone showed them how to use the hammer, without describing it, that person would still be able to use it when they needed it.

    If you are an instructor or presenter, required to deliver this knowledge, yes, you better know it; then you have the whole conversation of valid verbs vs invalid ones.

    “So, rant done,”

    And that’s all this was.
    One person’s take on what someone else should know, based on how he / she learned it, does it, and believes in it , and well, to be able to work for that person / company. As a prospective employer, that is your right.
    That does not make it right or absolute in the context of folks who do work daily in the field, learn and use what they know or need or where done differently.

    “Criticism is no use if you don’t make it constructive, and I’m not writing this to disparage anyone. ”

    The fact the you had to say this this way is no different than someone saying that ‘I don’t mean to insult you or be mean, but…’
    You sound just like many interviewers I have encountered in my career. They come in to try and scare you and prove to the candidate, that they are smarter than the candidate. Trick questions / brain teasers prove absolutely / vet nothing. They are just tricks that are only for the interviewer already knows the answer to try and come off as superior. I find them insulting personally and I never use them when I interview candidates. I am quite sure any candidates could ask you IT specific questions / scenarios that will stump the interviewer, but that is not an option. It’s only magic until someone shows you how it’s done. It can be right to you, because it your opinion and the way you run your shop.

    “I want to hire good people, ”

    So, does everyone, but that does not mean you have to hire exact duplicates of you. It is our differences, and different ways of approaching things that lead to progress and change. Making mistakes, changing how you think or learn is part and parcel of life.

    PowerShell’s mantra is ‘always discover’, ‘there are always many ways to do similar or needed things’. Some elegant, some not so much. After 40+ years in IT (Operations, Administration, Architect, Developer, Security Specialist, Business Owner) and an MCT since 2000, I have made my share of very stupid as well as huge successes. As I am sure many who may read this have as well.

    You are not going to really get this with this mentality. As I read through this. All this was easy for me, because I have done it and teach this stuff. But if I’d ever interview for a company that handled things in this manner. Even if they called back to continue the interview or make and offer. I’d would have already made the decision to move on.

    Strive to hire talent as well as the trainable. Give back to the community. Write Book, deliver classes. If candidates are not in your pool house, then you need to work hard to assist with trying to rectify that.

    “and I also want you guys to be better at stuff. ”

    This seems to imply that you don’t need to be better. That you have learned it all.
    As one who has been command line person since before many were even born, and using PowerShell since it’s inception (Monad Days). I would never assume I know it all.
    The most inexperienced can teach and / or give you new perspective on things. The most experienced provide clarity and proof.
    You want driven folks, not folks that can just regurgitate data points. Folks you can groom,

    You could have better said this, like so.
    “All of us need to be far better at this stuff. I work hard and work with my staff even harder to make sure they are. I strongly encourage all interested to keep digging, keep learning keep improving.”

    “PowerShell is a joyously fun language sometimes,”

    Agreed

    “but if you don’t know it well, you won’t enjoy it. ”

    Even when you know something well, frustration and failure is still there. It’s how you recovery from that, whcih is important.

    “I want people who’ve flunked a PowerShell test to go away”

    Really, based on what?

    Tests do not always prove anything. There many just bad test and test writers. As one with over 70 certs since the 1980’s, I have seen and complained about my share of them and even written and beta tested many. Many tests are written specifically for folks to fail, often times without write not even knowing they are doing it that way or maybe it’s intentional.

    I know many as I sure you do, who aced a driver’s exam, but are still horrible drivers.

    We all know marriage counselors, who have been married multiple times. It does not mean they cannot help you with yours.

    We all know the know it all types, that are unwilling to learn anything new or really share what they know to the world, that does not mean they are the best to go to for answers and assurances.

    We all know folks who can pass IT exams, but could not do the job if their life depended on it. We all know folks who are completely self-trained that could and would blow your most senior person out of the water but would never get considered, because of no degree or IT certification. Many even work for those folks, these days.

    “fix their fundamentals then come back and blow us all away”

    Then maybe, you should be writing books, teaching classes, vs pontificating just here.
    My expectations of an interview process is ‘can this person do the job or how soon could they get up to speed if I hired them’.
    As a veteran, no soldier comes in with any idea how, march, assemble and use a weapon, to eliminate an enemy combatant. No matter how much you train. Your first failure or hit is detrimental to your whole being in many cases, and you depend on others to get you through it, until you are cognizant of what you really have to do and how to move forward.

    HR and Interview need to get back to the fundamentals and put out factual and complete Job Descriptions a realistic skill requirements. Not this fantasy crap, that never really matches the interview or the role anyway.

    Well, that ‘come back and blow us all away’, thing is relative. They could ace the exam (just cause they want to give it a shot to see if they can), you make the offer and they tell you to they have accepted another position or not really interested in working for you or your org. IF you make the interview process horrible, good people can and will be lost. Those you would get could end up being jerks and a bad thing for the team. Everyone has to start somewhere, and someone has to give them a shot.

    “So, what should a prospective candidate do to ensure they ace the PowerShell questions and end up writing Windows automation for one of Australia’s niftiest Continuous Delivery shops?”

    This shows both pride and arrogance and is reflected in this entire article.

    Hand a candidate a task and cut them lose to complete it. Not some trick task, but a real task that you have to do every day and or done in a customer delivery. Let them complete it however, they choose. If they are successful, even if they did not do it your way, it’s still success.

    “First things first: Get over to Microsoft Virtual Academy and do their PowerShell jump starts. ”

    Ditto, and as a MCT since 2000, this and more I point folks to in and out of classes I deliver.
    Sad that you only point to this one, though good, there are tons of free training and resources to leverage.

    “Actually do them. Type along with the examples and get your hands dirty. ”

    Simple. Stop using cmd.exe, and use the console host, ISE, or VSCode with PoSH as default integrated editor

    “Actually write some PowerShell code as you watch. ”

    You need to preface this with, ‘Have a lot of patience, and be willing to hit pause rewind many times’. Also, understand that in many cases, the full code they are typing will not be readable or even shown completely. So, be prepared to figure it out.
    Just hit the community blogs and look at the question being asked and see if you can figure it out and provide answers. This is real life stuff vs the trick nonsense in interviews or the staged stuff from events.

    “Then once you’ve done the jumpstarts, watch the advanced sessions and maybe look into DSC.”

    Interesting that you’d jump straight to here (DSC) without talking or even hinting at code clarity, style and testing. Pester, is nowhere mentioned, yet you do tell folks to focus on the fundamentals. Code testing / validation should be as high as fundamentals on the list. Well before anything with DSC.

    “Try interacting with some public APIs, ”

    The everyday ITPro with no Dev experience and can’t even spell API.

    You have to know where to find them and why they should use them.
    How many if these ITPros would know that API calls have been possible in Windows scripting, since DOS/VBScript/VMB/Macro/WMIC/ADSI for decades now at cmd.exe?
    How many do you know, even those into PoSH today, who could. Especially if that is not where they started?

    These are fundamentals and the root of PoSH.

    “drag down some data and play around with filtering it and persisting it out to JSON files, then pick up those JSON files from another script use the data to call other APIs.”

    Again, many Dev have issue with JSON. Most ITPros have no idea what it is or why to use it.

    “Grab some logfiles from somewhere and fiddle around with parsing them. Package your stuff up as a module. Try some DSC.”
    OK, I’ll give you this one.

    “Above all else, don’t neglect the fundamentals”

    The fundamentals start at old Window’s Scripting and growing from there. Take you on .bat.cmb.vbs, scripts and try and convert them to PowerShell equivalents. Again, once you go PoSH, never cmd.exe unless you have no other choice. Never touch notepad again, the ISE is there for that. Well except for Server Core, and Nano deployments.
    If I see one more PowerShell MVP copying and pasting from notepad into the console host. It will take all that is in me to not hurl tomatoes at them. Use the ISE and VSCode for what they are best at. Keeping code visible, manageable, no repetitive, and deliverable. No one wants to see how fast you can type or how many mistakes you make along the way. Have your cold pre-built before the event. If you have to show the typing, guess what. Automate that as well and stop wasting attendees / students time, or making videos way to long because of all the random mistake prone typing.
    But I’ll restrain myself, because it is their way. So, whatever.

    “and try not to rely on Stack Overflow or Google or ExpertSexChange for answers, because those answers might work, but they might also be wrong,”

    As would relying on any book, class, video or person. SO, one has to vet for themselves or take what they are given at face value. So, this is a bad comparison. No one is perfect. No tech is perfect. No tech training, whitepaper, tech article, help file is perfect.

    Why, because they are all written by us humans, and despite those believing in their own hype. We are all very fallible and all of us can have our deployments or code looked at by another person (beginner – fully experienced) and they can and will find things wrong or things that could be done more elegantly or differently.

    Always be willing to learn! From anyone…
    Always be ready to encourage! Anyone…
    Always be ready to teach to those who are willing to learn and apply what was delivered!

    ” or at the least inelegant. Seriously, when you spend all day writing PowerShell, you’ll be glad of the elegant option.”

    Many ITPros don’t do this. The number of times I have been assisting major corporations with rollouts, lab, POC, Q&A, prod, and these folks still refuse to use PoSH or only when they have to and nothing beyond. I have lost count.

    The number of folks feel they can just turn it off globally, astounds me.

    The number of folks who believe it is a complicated mess and ay to hard to learn or that it is for developers. I have lost count.
    Do these folks put PoSH on their CV / Resume / Critical skills list. Sure, they do, but that is mostly because they have to use it for a particular solution / or infrastructure deployment, not that they are coding in PoSH all day every day.

    You cannot say, you are for example and Exchange, Lync, or SharePoint support person, architect, engineer and not have any PoSH experience. The products require the use of PoSH for many areas. This does not mean they are PoSH SME / Pro, but PoSH is a critical skill.

    Now, if they are applying for a DevOps role where all day deep PoSH skills is mandatory, then they should have never been brought in for the interview as you would already have looked down upon them based on your own admissions in this peace. So, don’t waste yours or their time.
    Do, pre-tests, to weed out the ones you’d never be interested in anyway.

    Make sure your HR department is better at the job posting. Be very specific about the requirements and do not over exaggerate. The number of times – in the very early Monad days – where I saw HR postings for candidates with 3 – 5 years Monad experience (when Monad and only be just released on only out for less than a year), again I have lost count.

    It’s just stupid, the number of ridiculous job postings in the IT field that I have seen that could never be filled based on what was in them.

    “Oh, and one last tip: when I ask you what the most important Cmdlet in PowerShell is, don’t say New-ADUser or I might have you escorted out of the building by security.”

    Again, this is a very arrogant and belligerent statement. You may be kidding but that is not the point.
    “I might have you escorted out of the building by security.”

    Again, as one that has been scripter for decades, and using Monad – PoSH (well the legacy scripting where orgs don’t allow PoSH). My reply to this question would have been. There is not ‘One single command that is most important’. There is a set of 10 – 20 commands that are paramount for all ITPros.

    However, based on you position throughout this piece. I would say the answer you are looking for is Get-Help.

    Again, all the commands in in the ISE by default when you open it. You can just copy and paste the command from there and use F1, on in the console host, use Show-Command to get to it.

    Despite, all the pontifications here, you gave nothing positive, to learn from. No real examples, and on the one pointer. You say you are looking for top folks; then you need to step up and help create vs just put down.

    — Reply Rant off—

  5. Mark Wragg says:

    Last time I was recruiting for engineers and looking for them to have PowerShell skills this was my exact experience. What I found was that people who listed PowerShell skills on their CV often actually meant that they had once supported Exchange and as a result were forced to use some PowerShell cmdlets/Google for some code that they didn’t entirely understand.

Leave a Reply to SanityCheck Cancel reply

Your email address will not be published. Required fields are marked *