Don Jones

Tech | Career | Musings

Axel writes:

How come cmdlets don’t act the same – or better yet, why is the syntax for similar things different? When I run Get-AzureADUser -All, I have to append a boolean $true for it to work. I would expect the switch to return true, if I append it to the cmdlet in the first place. Comming from Get-MsolUser that is pretty frustrating and pretty hard to explain, when spreading the good word.

I hope you’ll ask a question, too! Visit here for info.

You’re not going to love this answer, Axel, but it’s because people suck. The fact is, you’re right: A switch like -All should be a switch, but it isn’t. It’s defined as a Boolean parameter. That’s wrong. But programmers don’t always take the time to grok PowerShell’s subtleties, and so we wind up with weird artifacts like this. Even within Microsoft, where corralling 50,000 developers into a single set of practices is as practical as getting the planet in general to stop using Hungarian notation for variable names (it’s been dead for a decade, folks, move on).

When these commands live in the open source world, you can and should log a bug on them for these kinds of design decisions.

So, does this make PowerShell look bad? Meh. Sure, PowerShell’s number one selling point was to provide the consistency you’re lacking, here, but on the other hand, we do live in a big, squishy world with edge cases and weirdness. I mean, the Linux people have gotten on for decades (counting Unix) with the least-consistent set of management tools the universe has ever seen, so we’ll probably live. And remember, consistency isn’t the shell’s only selling point!

Update: See, I told you you wouldn’t love the answer. I’ll point out that I’m just trying to say it like it is, not make excuses for anyone, and that I don’t work for Microsoft and can’t “fix” this problem. Who can? Microsoft’s customers. As I point out in a comment below, Microsoft is more responsive to customers these days, but you have to sound off. If you’re a customer of a product like this, and you want it fixed, open a Product Support case and request that a bug be filed. Yes, that’s work on you, but it’s how Microsoft deals with non-open-source products. For open source products, open a big yourself (easier). But if the paying customers don’t drive for change, nobody else is going to, and Microsoft quite reasonably isn’t going to worry a lot unless paying customers are raising a stink. To date, I’ll absolutely bet you that nobody’s filed a single bug on the issue Axel raised above.

I also want to emphasize that this is not a PowerShell problem. I know this is a little opaque from outside Microsoft, but I get insider peeks that I’ll share with you. The PowerShell team basically only writes PowerShell; other folks write the commands for their products. The AD team wrote the AD commands, and I imagine someone on the Azure team writes their commands. This isn’t a “clean up of PowerShell;” it’s a problem to address with the product team who write the commands in question. Addressed as, again, a paying customer.

Categories: Tech

5 thoughts on “AMA: Why Aren’t PowerShell Commands More Consistent?

  1. wandermuch says:

    Sounds like code for “we don’t care. We have 50k+ resources but will not devote any of them to cleaning up bad code in one of our most important products. “

    1. Don Jones says:

      That’s not ENTIRELY wrong, unfortunately, although no one product team has 50k resources, obviously. If you’re a paying customer, you’re the one one who can help make them care. And you’ have to do so knowing that the time taken to fix that would mean something else didn’t get done, so you’d have to be willing to give something up in order to get a “fix” for something like this. Microsoft responds pretty well to loud customers; too few of their customers actually are very loud, though, or care enough to – for example – open up a Product Support ticket over the “bug.” And, to be fair, the Azure PowerShell commands are not one of their most important products. Azure is, sure, but unless customers are being loud, then the PowerShell pieces compete for attention with Azure CLI, the Azure Portal, and lots of other tools.

  2. Axel says:

    Well, I don’t mind giving Microsoft my opinion:

    A support ticket is probably a bit much 🙂

  3. agazoth says:

    I don’t mind telling Microsoft, that their are bugs:

    Doesn’t take long and a support case is just going to amount to a reference to the documentation in this case.

    We have to keep developers on their toes 🙂

  4. William Foster says:

    indeed, write clearly and write often.

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: