Don Jones on Everything You're Doing Wrong in PowerShell

Thinking scripts instead of functions is just one of the many ways you're missing out on the true power of PowerShell.

Don Jones is one of the preeminent PowerShell MVPs, authors and trainers. And if anyone knows what you (and the rest of the IT world) is doing wrong in PowerShell, he does.

So we caught up with him ahead of his session, "Everything You're Doing Wrong in PowerShell," at Live! 360 this December in Orlando to find out a bit more about what most people are doing wrong (and right) with Microsoft's ubiquitous task automation framework.

What is the No. 1 thing that IT admins do wrong in PowerShell and why is it so bad?
Writing monolithic scripts instead of modular, advanced functions. People end up working way harder than they need to, and they produce things that miss out on all the work PowerShell itself is willing to do for you.

What is No. 2?
Treating PowerShell like a programming language. It has one, sure, but it's not C# and it's not VBScript. Understanding and embracing that is not only key to being more efficient, it's key to avoiding most of PowerShell's weirder gotchas.

What is your No. 1 best practice when it comes to PowerShell, either for beginners or for longtime pros who've maybe gotten into some bad habits?
Don't try to invent new usage patterns that contradict the ones already in the shell. People tend to do this inadvertently because they've not taken the time to understand the native patterns, and they end up coding themselves into some mighty ugly corners.

"The key with doing things 'right' in PowerShell is to understand why PowerShell exists and what it was meant to solve. It's a tool, and like any tool, there are right and wrong times and places to use it."

Don Jones, PowerShell MVP

What is the correct approach for advance functions?
Follow the native patterns. An advanced function is a command, just like a cmdlet, and should look and feel the same as one.

What is a quirk or two about PowerShell that you think might trip people up sometimes, or lead to bad habits?
It's got some stuff in it, like the "return" keyword, that can make you think it's a language like C#. It isn't. Honestly, even the product team regrets some of those decisions, because it gets people working in an entirely wrong direction.

What else do you want to share with our readers about your "Everything You're Doing Wrong in PowerShell"session before it takes place in Orlando in December?
The key with doing things "right" in PowerShell is to understand why PowerShell exists and what it was meant to solve. It's a tool, and like any tool, there are right and wrong times and places to use it. That's really what the session hits on.

About the Author

Becky Nagel is the vice president of Web & Digital Strategy for 1105's Converge360 Group, where she oversees the front-end Web team and deals with all aspects of digital strategy. She also serves as executive editor of the group's media Web sites, and you'll even find her byline on PureAI.com, the group's newest site for enterprise developers working with AI. She recently gave a talk at a leading technical publishers conference about how changes in Web technology may impact publishers' bottom lines. Follow her on twitter @beckynagel.


  • Office Mobile Apps To End as Microsoft Highlights New Office App

    Microsoft plans to end support for Windows 10 Mobile applications on Jan. 12, 2021, according to a Friday announcement.

  • Is Microsoft Finally Reinventing Office?

    Microsoft is testing out a new technology called "Fluid Framework." It could mean that Brien's dream of one Office app to rule them all might soon become reality.

  • Azure Active Directory Connect Preview Adds Support for Disconnected AD Forests

    Microsoft on Thursday announced a preview of a new "Cloud Provisioning" feature for the Azure Active Directory Connect service that promises to bring together scattered Active Directory "forests."

  • Microsoft Defender ATP Gets macOS Investigation Support

    The endpoint and detection response (EDR) feature in Microsoft Defender Advanced Threat Protection (ATP) has reached the "general availability" stage for macOS devices.

comments powered by Disqus

Office 365 Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.