虚拟机连入错误
Start-VM -Name “win 10”
Stop-VM -Name “win 10” -Force
Restart-VM -Name “win 10” -Force
C:\Windows\System32 ❯ Get-VM
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version
win 10 Running 0 4096 00:07:55.2750000 正常运行 12.2
edgec@Atom took 484ms 00:15:51
C:\Windows\System32 ❯ Enter-PSSession -VMName “win 10” -Credential (Get-Credential)
用以登陆,需要管理员权限
[win 10]: PS C:\Users\edge\Documents> query session
会话名 用户名 ID 状态 类型 设备
services 0 断开
console 1 已连接
31c5ce94259d4… 65536 侦听
rdp-tcp 65537 侦听
我感觉链接不上的问题就是 console 已连接 ,所以在想怎么解决
logoff 1
query session
⭐ 方法 3:从宿主机查询虚拟机 IP(如果虚拟机内部非常卡)
在宿主机(你的物理电脑)PowerShell 里运行:
Get-VMNetworkAdapter -VMName “win 10”
你会看到:
IPAddresses : {192.168.137.112}
如果显示空白,说明网络在 DHCP 获取阶段,等几秒再查一次。
🔧 稍微高级一点:只显示 IPv4 的最简宿主机命令
(Get-VMNetworkAdapter -VMName “win 10”).IPAddresses