PowerShell with a Purpose Blog

What To Do / Not to Do in PowerShell: Part 10

Whenever you're writing a script, function, or even an advanced function, you should give those things a cmdlet-style name, consisting of a Verb-SingularNoun. You get to make up your SingularNoun, but the Verb should come fromthis list at Microsoft (scroll down to see the 7 Verbs catagories, and click on one to see its verbs).


Consistency. As an admin, I know what a Get cmdlet does. I know what to expect from Invoke, Write, Out, Format, Export, Set, New, and so forth. Throw me some weird verb like "instantiate" and I'll have no clue what to expect. I won't be able to discover that cmdlet on my own, either, because it doesn't have one of the standard verbs.

Consistency in cmdlet names (as well as parameter names) is a key to helping people use your command more easily and effectively. 

What's more, you shoudl get in the habit of appending some company-level prefix to your nouns. Work for Boeing? Maybe your cmdlet names should look like "Get-BngUser" so that there's less chance of them ever conflicting with someone else's cmdlet names. Oh, and never use the "PS" prefix - that's reserved for the PowerShell team at Microsoft.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.