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:
Get-SCVMHost : Cannot convert ‘System.Object[]’ to the type ‘System.String’ required by parameter ‘ComputerName’. Specified method is not supported.
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:
The Get-Host from SCVMM is the one being used
I scrolled down a bit more and found the one I wanted:
Hyper-V API Function
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: