Could you give me some advice?
I want to know the status of the device.
[Virtual Machine Properties ]
NetworkAdapter ... "network001"
[Device Status]
connected <----- check on or off ?
Connect at power on <----- check on or off ?
I tried [Get-NetworkAdapter -VM VMNAME] , but did not get along well ...
is there something good way ?
Sincerely
The ConnectionState properties contain the equivalents to these check boxes in the GUI:
(Get-NetworkAdapter -VM MyVM).ConnectionState.Connected
(Get-NetworkAdapter -VM MyVM).ConnectionState.StartConnected
If checked, it will return a True value. If unchecked, False.
The ConnectionState properties contain the equivalents to these check boxes in the GUI:
(Get-NetworkAdapter -VM MyVM).ConnectionState.Connected
(Get-NetworkAdapter -VM MyVM).ConnectionState.StartConnected
If checked, it will return a True value. If unchecked, False.
Dear MKguy
Thank you for giving me good advice !
I got very good results
---------------------------------------------------------------------
$AuditVM = @()
foreach ($vm in Get-VM | Where-Object {$_.PowerState -eq "PoweredOn"}) {
foreach ($nic in Get-NetworkAdapter $vm | Where-Object {$_.ConnectionState.StartConnected -eq $False}) {
$objVM= "" | Select Name,NetworkName,ConnectatPowerOn,Connected
$objVM.Name = $vm.Name
$objVM.NetworkName = $nic.NetworkName
$objVM.ConnectatPowerOn = $nic.ConnectionState.StartConnected
$objVM.Connected = $nic.ConnectionState.Connected
$AuditVM += $objVM
}
}
$AuditVM
---------------------------------------------------------------------
Thanks again.