The challenge here is that to test a TCP connection to a remote host, that remote host needs to have a service running to respond back. In the case of VMM, VMM installs an agent to that remote host, which then communicates back with VMM.
In other cases, the communications only happen adhoc, such as doing a BITS file copy, so there will not typically be a service on the remote end active to respond to test for.
You could potentially install the VMM Agent manually, then run some connection tests between the VMM server and the remote host. Instructions for installing VMM Agent Locally:
here
As documented, the ports used by VMM to communicate to hosts include (80/135/139/445/443/5985/5986/2179/623) There could potentially more. See
here
The critical ports I have observed are:
- 135/139/445 WinRM
- 2179 RDP from VMM to Host
- 5985 Hyper-V Control Channel
Next, you can then use the Powershell command Test-NetConnection Another challenge is the communications are slightly different from VMM to Host, verses Host to VMM. So you need to test each side individually.
VMM to Host:
- Test-NetConnection -ComputerName <host> -Port 135
- Test-NetConnection -ComputerName <host> -Port 139
- Test-NetConnection -ComputerName <host> -Port 445
- Test-NetConnection -ComputerName <host> -Port 2179
- Test-NetConnection -ComputerName <host> -Port 5985
Host to VMM:
- Test-NetConnection -ComputerName <VMMserver> -Port 135
- Test-NetConnection -ComputerName <VMMserver> -Port 139
- Test-NetConnection -ComputerName <VMMserver> -Port 445
- Test-NetConnection -ComputerName <VMMserver> -Port 5985
*Caution: There may be more ports, I have not tested this completely.
To script this could then be done simply. Start with:
$result = Test-NetConnection -Port 135 -ComputerName IP3-Comp-2-4
$result.TcpTestSucceeded
True
An example output of the Test-NetConnection command is:
PS C:\Users\administrator.IP3> Test-NetConnection -Port 5985 -ComputerName IP3-Comp-2-4 -InformationLevel Detailed
ComputerName : IP3-Comp-2-4
RemoteAddress : 172.104.3.24
RemotePort : 5985
AllNameResolutionResults : 172.101.3.24
172.103.3.24
172.104.3.24
2002:ac65:318::ac65:318
2002:ac67:318::ac67:318
2002:ac68:318::ac68:318
fe80::25ed:9ac0:71ce:d7b9
MatchingIPsecRules :
NetworkIsolationContext : Private Network
InterfaceAlias : StorageB
SourceAddress : 172.104.3.51
NetRoute (NextHop) : 0.0.0.0
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : True
-ROK