Hello,
I'm trying to get Network-Adapter status with OS details with the below script.
everything is collected except the OS Full Name and OS family not sure where's the issue
Get-VM |
Sort-Object -Property Name -PipelineVariable vm |
ForEach-Object -Process {
Get-NetworkAdapter -VM $vm |
Where-Object { $_.ConnectionState.StartConnected -ne $true} |
Select-Object @{N = "VM Name"; E = {$vm.Name }},
@{N = "Power State"; E = { $vm.PowerState } },
@{N = "Interface"; E = {$_.Name }},
@{N = 'ConnectionState'; E={if($_.ConnectionState.Connected){'Connected'}else{'NotConnected'}}},
@{N = "Type"; E = {$_.Type }},
@{N = "Connect on Boot"; E = {$_.ConnectionState.StartConnected}},
@{N = "OS Full Name"; E = {$_.ExtensionData.Guest.guestFullName}},
@{N= "OS Family"; E = {{$_.ExtensionData.Guest.guestFamily}}
}
} | Export-Csv -Path .\NetAdapterStartUp.csv -NoTypeInformation -UseCulture