Author Posts

November 1, 2017 at 9:41 pm

I can find guidelines about the naming convention for new cmdlets and new modules.

But what about an improved cmdlet of an existing module.
For example, let's say I want to improve the Get-SmbShare cmdlet from the SmbShare module by adding a new parameter to the cmdlet.
How could I name my module?

  • SmbShare2
  • SmbShareExtended
  • SmbShareImproved
  • ...

Same question for the cmdlet inside the module. How could I name it?
I've seen for example a Get-ChildItem2 cmdlet.

I couldn't find any official guidelines about that...

November 1, 2017 at 10:09 pm

If you have a little time left you could watch this video ... the relevant part is in the last quarter if I remember right ... have fun!

I guess they called it proxy cmdlet or cmdlet proxy or something like this.

November 1, 2017 at 11:12 pm

I've used two approaches that are my own home-spun-ideas (certainly not guidelines):

1: Append an M to the command for improved, akin to vim for vi in Unix. So Verb-NounM
2: I've "broken the rules" for one lone command which has really no impact as I'm the only person that uses the function. It's my exception to the Verb-Noun rule. Explained:

I used to alias cvi to Connect-VIServer. One day I elected to add the functionality of putting the VIServer I'm connect{ing,ed} to in the title bar as I maintain several Virtual Centers. Yes, I prefer to set PowerCLI to Single VIServer Mode and have a separate window for each. Or, if I disconnect from one and connect to another, the correct Virtual Center is reflected in the title bar. Crude but effective (per my buddy Darth).

Ergo I made the function below to a) add functionality to the command and b) maintain my "alias". I know this isn't textbook and if someone has a better idea, I'm all for it.

function cvi
Connect-VIServer -Server $args[0]
$host.ui.RawUI.WindowTitle = $global:DefaultVIServer

November 2, 2017 at 11:59 am

My favorite method for customized cmdlets is to add a prefix to the noun. Like your initials, or a company stock symbol, or something like that. So Get-LFSMBShare and Set-LFSMBShare. The benefit to that method is in command discovery. Get-LF will autocomplete through all of your customized cmdlets. Seems easier to find too when you're doing things like get-command, etc.

November 5, 2017 at 9:52 pm

Thanks all for your suggestions! 🙂