Get-SCVirtualMachine : A parameter cannot be found that matches parameter name ‘ComputerName’.
At line:1 char:22
+ $VM = Get-VM [MyVMName] -ComputerName [MyVMHost]
+ CategoryInfo : InvalidArgument: (:) [Get-SCVirtualMachine], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetVMCmdlet
When looking into the help-contents I could of course clearly see that indeed there was no parameter named ‘Computername’ while I was sure I got this exact parameter from the help-contents.
In other words:
There are two commands for ‘Get-VM’: Microsoft introduced a Get-VM-cmdlet Hyper-V powershell module in Windows 2012 which DOES contain a parameter -Computername. The original Get-VM cmdlet which was part of the SCVMM 2008 R2 powershell snap-in is now renamed to Get-SCVirtualMachine in VMM 2012 but an alias ‘Get-VM’ was also created in the new module. This is probably for backward compatibility purposes but leads to conflicting results when importing both modules in the same script.