Chapter 8. Advanced functions, part 2

Once you’ve started creating advanced functions, it’s easy to want them to do more and more and more. In this chapter, we’ll take advanced functions a bit further, adding a number of useful features to them. We’re going to try to get as much functionality as possible for as little work as possible, letting PowerShell do most of the work for us—meaning we won’t have to do very much programming!

8.1. Making parameters mandatory

We want to ensure that our command has everything it needs when it runs, which means we might have to prompt someone for a computer name or an error log filename. We’d rather provide a simple default value for the error log filename, but we definitely want to prompt for that computer ...

Get Learn PowerShell Toolmaking in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.