I have Hyper-V on Windows Server 2012, and in the Hyper-v I have CentOS 6/7 vm.
I doing the following command:
Get-vm -name "x" | select -ExpandProperty NetworkAdapters
Output:
Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses
---- -------------- ------ ---------- ---------- ------ -----------
Network Adapter False "x" InternalSwitch Mac {Degraded, protocolversion} {}
Why is IPAddresses
empty?
I tried (command).ipaddresses
and got the same result.
Best Answer
I had to install Linux Integration Services to the virtual machine (Linux Integration Services 4.1):
CentOS72
).install.sh
as root.For CentOS 7 it also required to disable NetworkManager. That (and other hints) is told in Supported CentOS and Red Hat Enterprise Linux virtual machines on Hyper-V (Notes 2 for NetworkManager)
Run:
systemctl disable NetworkManager
and rebootNow the Hyper-V Manager should show you the IP address of the VM and
Get-VM
should also work.