views:

11

answers:

1

I ran into an issue while using both the Vmware PowerCLI and System Center Virtual Machine Manager snap-ins for PowerShell. They both contain similarly named cmdlets, like 'Get-VM' and 'Get-VMHost'. It appears that the last snap-in to load wins, so I added logic in my script to load & un-load the snap-in when I needed to get either VMware data or Hyper-V data. I'd like to know if there is any way to prevent this contention, or otherwise create some unique handle to one cmdlet, while still allowing the other to load & operate as intended?

+1  A: 

The best approach when using snapins is to fully qualify the cmdlet name with the snapin name. For instance, if the snapin name for PowerCLI is PowerCLI then use:

PowerCLI\Get-VM

For the SCVMM snapin use it's name as a prefix. To see the snapin names, execute:

Get-PSSnapin -Registered
Keith Hill