Articles

PowerShell articles, tutorials, and guides from community experts.

Don Jones
PowerShell for Developers

High-Level: Designing Your PowerShell Command Set

So you’ve decided to write a bunch of commands to help automate the administration of ____. Awesome! Let’s try and make sure you get off on the right path, with this high-level overview of command design. Start with an inventory You’ll need to start by deciding _what commands to write, _and an inventory is often the best way to begin. Start by inventorying your nouns. For example, suppose you’re writing a command set for some internal order-management system.

Don Jones
Announcements

Help Me Test SSL on PowerShell.org

I’d appreciate your help in testing HTTPS/SSL here on PowerShell.org. Right now, it’s “voluntary,” meaning you have to explicitly ask for https://powershell.org. If you have any problems, please note them in a comment on this article. Some notes and known problems: Most pages will not show the “lock” address bar icon in your browser, because we’re delivering mixed content. For example, the site logo is being hardcoded as http:// by some Javascript in our theme, which I need to sort out.

msorens
PowerShell for Admins

Complete Guide to PowerShell Punctuation

Quick as you can, can you explain what each of these different parentheses-, brace-, and bracket-laden expressions does? ${save-items} ${C:tmp.txt} $($x=1;$y=2;$x;$y) (1,2,3 -join '*') (8 + 4)/2 $hashTable.ContainsKey($x) @(1) @{abc='hello'} {param($color="red"); "color=$color"} $hash['blue'] [Regex]::Escape($x) [int]"5.2" When you’re reading someone else’s PowerShell code, you will come across many of these constructs, and more. And you know how challenging it can be to search for punctuation on the web (symbolhound.com not withstanding) !

Mike F Robbins
Events

MSPSUG June 14th Virtual Meeting: Pester the Tester PowerShell Bugs Beware!

Join the Mississippi PowerShell User Group virtually on Tuesday, June 14th 2016 at 8:30pm Central Time when Microsoft MVP Robert Cain will be presenting “Pester the Tester: PowerShell Bugs Beware!”. So you’ve been developing PowerShell for a while, or perhaps you’re taking over maintenance of an existing set of scripts. It would be great to get extra confidence in your scripts through testing, but how? You’re in luck, there’s a new module in town, Pester!

Matthew Hodgkins
DevOps

5 Tips for Writing DSC Resources in PowerShell 5

PowerShell 5 brought class based DSC Resources, which majorly simplifies the process of writing custom DSC resources. During my time working on some custom resources, I developed some tips a long the way which should save you some time and pain during your DSC journey. The tips cover: Structuring your class based DSC Resources Making it easier to get IntelliSense based on your DSC resources without constantly copying them into the module path Using PowerShell ISE IntelliSense when writing DSC configuration Troubleshooting resources which aren’t being exposed correctly from your DSC Module Testing classed based resources with Pester Head over to https://hodgkins.

Don Jones
PowerShell for Admins

My DevOps (DSC) Camp Detailed Agenda

If you’re deep into DSC and delving into DevOps, then my summer “Camp” event is probably meant for you - and now there’s a detailed agenda, overall agenda, and full event brochure. This is a really limited event - under 20, including product team participants, and we’re down to just a few seats left. DevOps and DSC Camp Detailed Agenda

Richard Siddaway
Announcements

Request for Topics

Putting on an event like the PowerShell and DevOps Global Summit involves a lot of planning. We started the planning process for the 2017 Summit BEFORE the 2016 Summit started! We have to work so far in advance that we’re taking guesses at the topics that will be of high interest next April – remember that we fix the agenda 6 months before the actual Summit. Part of the process of creating the agenda is that we publish a ‘Call for Proposals’ where we ask potential speakers to submit session proposals.

pscookiemonster
DevOps

Slack and PowerShell

Having a platform that enables ChatOps can be a game changer. You can quickly see changes, alerts, build status, discussions, emergency chats, and more, all in a single, searchable interface. If you can sift through the gifs. Bots are a hot topic these days, and and it’s well worth checking out Matt Hodgkins bit on integrating PowerShell with Hubot. Bots are a great alternative to trying to spin up a web front end for PowerShell.

msorens
PowerShell for Admins

Practical PowerShell Unit-Testing

By the time you are using PowerShell to automate an increasing amount of your system administration, database maintenance, or application-lifecycle work, you will likely come to the realization that PowerShell is indeed a first-class programming language and, as such, you need to treat it as such. That is, you need to do development in PowerShell just as you would with other languages, and in particular to increase robustness and decrease maintenance cost with unit tests and–dare I say–test-driven development (TDD).

Tim Curwick
Tips and Tricks

Getting complex – More line breaks in Powershell

This is a follow up to Jacob Moran’s article Keeping it simple - Line breaks in PowerShell. I am strongly in the pro backtick camp, but I won’t get into that debate here. Instead, I’ll cover more of the common ground between the two camps. In addition to after a pipe, there are many, many more places where you can put in a line break without a backtick and without breaking your code.