Hey @John-DeWilde ,
I need some more information to help you. When you say you cannot connect to a Hyper-V session, do you mean connect to a virtual machine on a Hyper-V server or connect to the Hyper-V server itself? If you are trying to connect to a VM, are you connecting from the Hyper-V server or a remote machine?
Enable-PSRemoting cmdlet is run on the destination machine, and only needs to be run once. This configures the machine to accept inbound connections.
-VMName parameter is referring to the name that appears in the Hyper-V console. This is a display name only, it might not be the same as the actual hostname of the VM. For example, in my Hyper-V console, there is a VM with the name ITProTVDemoSync. The hostname of the machine is svr01. You can right-click on a VM in the Hyper-V console and rename it. This does not change the hostname of the VM, just the display name in the console.
When I run
Enter-PSSession from the Hyper-V host, I use the
-VMName parameter, the Hyper-V host knows what VMs exist (
Get-VM on the Hyper-V host will return a list). But if I run
Enter-PSSession from my laptop to connect to the same VM, I use
-ComputerName. My laptop doesn't know its a VM, just sees it as another machine on the network. The parameters
-VMName are just ways to identify the machine you are trying to connect to. Which one you use depends on where you are connecting from.
You also have to think about the credentials being used. Since you are using workgroups, the credentials you are logging in to the Hyper-V host don't have permissions on the VM. You will need to use the
Enter-PSSession -VMName ITProTVDemoSync -Credential demo\mike
It will prompt you for a password.
You also need to add the destination machine to the TrustedHosts list on your local machine. The machine you are connecting from needs to trust the remote machine in order to send credentials. If you are connecting to a VM from the Hyper-V server, you can skip this.
For example, on my laptop, I want to connect to dc01 and svr01, so I must tell my laptop it is ok to send credentials to those machines.
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "dc01,svr01"
You can check your TrustedHosts list using
I know that is a lot of information to digest, I would suggest taking one step at a time. First, let's get more information so I know exactly what you are trying to do.
- Where are you connecting from, the Hyper-V server itself or another machine on the network?
- Can you copy and paste the error message you are getting?