I am currently authoring a PowerShell reporting script that exclusively uses functions from the Windows Server 2012 Hyper-V API. When I imported the module for System Center Virtual Machine Manager, I noticed that a function that I previously used was giving me an error:
I then realized that the Get-VMHost commandlet was now being invoked from the SCVMM library, which does not support getting hosts from an array of names like the Hyper-V API does. So how does how go about letting PowerShell know that we want to use the Get-VMHost commandlet from Hyper-V?I had no idea, and searching the web yielded nothing. I then followed my Visual Studio instinct and thought intelisense would shed some light…and it did.
When I right-clicked and selected Start Intellisense on the function, I could see which library it was using:
I scrolled down a bit more and found the one I wanted:
Once I selected the correct function, PowerShell ISE took care of the rest and wrote down the syntax (which I had no idea about) to avoid ambiguity when calling functions: