using PSHyperV with Invoke-Command

May 11, 2012 at 2:39 PM

I'd like to use PSHyperV with Invoke-Command.

I installed PSHyperV on both my 2008 R2 Hyper-V server, and my windows 7 machine. I write my scripts on my Windows 7 machine. Due to a complexity in what i'm trying to achieve, I can't use the "Classic remoting" available in PShyperV, but have to resort instead to WinRM and PowerShell remoting.

Whenever I use simple commands like:

Invoke-Command { Get-VM } -ComputerName NameOfHyperVServer -Credentials machine\administrator

I get an error saying that Get-VM is not a recognized cmdlet. Also, when I open a regular powershell window (on the console of the server), I get the same error.

I've already added the file in %windir%\system32\WindowsPowershell\v1.0\modules - how can i make them register automatically?