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!
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 name if one isn’t provided. Fortunately, there’s no coding required to make that happen! Check out the following listing.