Udostępnij za pośrednictwem


How to differentiate between two cmdlets with the same name

In some instances, more than one product can have a cmdlet with the same name. This blog post will show you how to specify a VMM cmdlet if another product has a cmdlet with the same name:

 

If two Windows PowerShell modules contain cmdlets with the same name, use the following format to specify the one you want:

 

<Module>\<Cmdlet>

 A typical output from PowerShell is the following if you don't fully differentiate between the cmdlets.

<<

PS D:\Users\mlmich> get-help get-job

Name                              Category  Synopsis
----                              --------  --------
Get-Job                           Cmdlet    Gets Virtual Machine Manager job objects on the Virtual Machine Manager ...
Get-Job                           Cmdlet    Gets Windows PowerShell background jobs that are running in the current ...

>>

Note: The same syntax also works if two Windows PowerShell snap-ins contain cmdlets with the same name:

To fix this and get the help for the cmdlet you want for example, use the following approach. 

Get-Help Microsoft.PowerShell.Core\Get-Job -detailed

Get-Help Microsoft.SystemCenter.VirtualMachineManager\Get-Job -detailed