Book Image

PowerShell Troubleshooting Guide

By : Mike Shepard
Book Image

PowerShell Troubleshooting Guide

By: Mike Shepard

Overview of this book

Table of Contents (15 chapters)
PowerShell Troubleshooting Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Unapproved verbs


In Chapter 1, PowerShell Primer, and Chapter 4, PowerShell Professionalism, we discussed the approved list of verbs and how the module system will issue a warning when a module exports a function with an unapproved verb. We saw that there was a switch called –DisableNameChecking that suppressed the warning. Not seeing the warning is acceptable if we don't have access to the source code (as is the case with the SQLPS module discussed in Chapter 4, PowerShell Professionalism), but in our own code we are able to be more careful. In situations where we are creating a new module, consideration can be made for what functions are performed. By consulting the list of approved verbs provided by Get-Verb, we should have no issues creating an appropriately named set of functions.

The instance where we are bound to run into an issue, as is the case with most of the code smells we are discussing, is where we find code that is already in use and that violates this principle. Given a well...