2

I am tearing my hair out at the moment trying to do this. Just a couple of things to clear up:

  1. I have Windows Hyper-V Server 2012 R2 freshly downloaded and Remote Administration enabled;
  2. I have a Windows 7 Professional machine - up to date etc. etc.
  3. I know you cannot manage Hyper-V 2012 R2 from Windows 7 using the GUI, that's why I want to use PowerShell;
  4. I've been using PowerShell for a while but all this remote connection stuff is very new;

So with that out of the way, let's go.

I've used Connect-PSSession to connect to the PowerShell session on the Hyper-V server. No problem. Remote commands don't work (get-vm for example), I'm assuming because I don't have them installed locally. I tried to do import-pssession (which is what I use when I'm managing Office 365 with PS remotely) and that works but doesn't give me any hyper-v cmdlets to use. I have tried to import-module hyper-v and it doesn't exist.

So I'm stuck. I've been Googling for about 2 hours now with no luck. Plenty of very old articles about how to connect to Server 2008 ort 2012 from Windows 8 but nothing on how to connect to it from Windows 7.

Any help?

  • Making no assumptions, I presume you've imported the Hyper-V module ? – Mbond65 Aug 13 '14 at 15:02
  • Yeah, tried that. No valid module file found. (updated original question) – pauby Aug 13 '14 at 15:06
  • 2
    You need the module on your machine and imported otherwise no cmdlets you run will be found/execute. You can install the module, it's under Windows Features -> Hyper-V -> Hyper-V Module for Windows Powershell. Once you've installed it, run Get-Module -ListAvailable to confirm it's on your system, then import the module as normal. Once imported and connected to your Hyper-V host, you can use all the cmdlets in the module such as Get-VM. – Mbond65 Aug 13 '14 at 15:08
  • On which machine? Windows 7 doesn't have a Hyper-V option under features and the Hyper-V Server doesn't have a GUI. – pauby Aug 13 '14 at 15:53
  • You could try this library on Codeplex pshyperv.codeplex.com, otherwise I don't know I'm afraid. – Mbond65 Aug 13 '14 at 16:12
1

Do this:

  1. Create a new PSSession on your Hyper-V host
    $Session = New-PSSession -ComputerName [Hyper-V Host] -Credential (Get-Credential)
  1. then enter it:
    Enter-PSSession $Session

Your PowerShell prompt will change to indicate you're connected to the remote machine. Any powershell commands you run will be ran on the remote machine. Try it, you'll find Get-Vm now works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.