My last post of the night. While reviewing scripts, I have seen multiple entries that are something like the following:
- Move-LogFiles
- Move-ApplicationLogs
- Move-Files
- MoveFile
What is the problem with this you ask? Well, for starters, there are no plural nouns with function names. Run this command and let me know how many plural nouns you find.
Get-Command -CommandType cmdlet | Select -Unique Noun
It should be 0. When creating a function or even naming a script, you should take care in naming it using a Verb-SingularNoun format to keep in line with PowerShell best practices such as Move-LogFile or Move-ApplicationLog.
Also keep in mind the verbs as well. You can find all legal verbs using the following command:
Get-Verb
Use any of the Verbs listed and you can’t go wrong (unless the verb being used is completely different than its intended purpose!).
Pingback: Scripting Games 2013: Thoughts After Event 1 | Learn Powershell | Achieve More
Guilty! Changed my script from move-logs to move-log. Thanks for the info!