VMware Cloud Community
vmwareforumsuse
Contributor
Contributor

Powershell noun pre-fix conflict

Looks like vmware chose not to use a unique noun prefix, is there an easy way to add, lets say 'VS' (for vsphere), as a prefix when installing your module?  Also where can i submit a bug report to get you folks to make this change default?

Edit: found the answer to my first question `Import-Module -Prefix` (but is this respected by the module?)

edit2: this still breaks the hyper-v cmdlets

edit3: Does the powercli module not respect the -prefix flag when importing the module?

0 Kudos
4 Replies
LucD
Leadership
Leadership

What would be those "conventions" you refer to?

And I assume you meant to say "noun" prefix, because the verb part is fixed as Get-Verb will show.


The PowerShell architect himself wrote a post on cmdlet collision way back in 2009 (see What's Up With Command Prefixes?).

Meaningful in there are his 3 closing remarks why the PS team themselves didn't use noun prefixes.

And then there is the history part.

Since VMware PowerCLI was a very early adapter of PowerShell, their VM cmdlets where the first ones that were there.

You could equally open a "bug report" with MSFT, asking why they didn't prefix their Get-VM and Get-Cluster cmdlets with HV.

In conclusion, you can't avoid having collisions, and that is why the available options to bypass them (-Prefix is just one of them) are there and useful.

For bug reports you need a Support Contract and you can raise a SR with GSS.

For ideas on how to improve/extend PowerCLI there is the Ideas Website.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
jpsider
Expert
Expert

Your current avatar is very reflective of this post.

You can submit requests here:

VMware PowerCLI

Cheers!

0 Kudos
vmwareforumsuse
Contributor
Contributor

Does the -prefix flag work though?  maybe i'm doing it wrong?  what are the other mechanisms for fixing this?

and yes, i meant noun.

0 Kudos
detlefsch
Contributor
Contributor

The prefix flag doesn't work when you import the VMWare.PowerCLI module. This module actually is only a meta-module importing all the VMWare.VimAutomation.* modules.

You can however import the single modules you need directly using the prefix flag

0 Kudos