HI LucD,
I am getting below error and report is empty.
PS C:\> Get-View -ViewType VirtualMachine -Filter @{'Name' = $vmNames } -PipelineVariable vm |
>>
At line:1 char:87
+ ... e VirtualMachine -Filter @{'Name' = $vmNames } -PipelineVariable vm |
+ ~
An empty pipe element is not allowed.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : EmptyPipeElement
PS C:\> ForEach-Object -Process {
>>
>> $vm.Config.Hardware.Device | where { $_ -is [VMware.Vim.VirtualEthernetCard] } |
>>
>> ForEach-Object -Process {
>>
>> $_ | Select @{N = 'VM'; E = { $vm.Name } },
>>
>> @{N = 'Running OS'; E = { $vm.Guest.GuestFullName } },
>>
>> @{N = 'VMware Toos Status'; E = { $vm.Guest.ToolsStatus } },
>>
>> @{N = 'vNIC'; E = { $_.DeviceInfo.Label } },
>>
>> @{N = 'Network'; E = { (Get-View -Id $_.Backing.Network -Property Name).Name } },
>>
>> @{N = 'ConnectionState'; E = { if ($_.Connectable.Connected) { 'Connected' }else { 'Not connected' } } }
>>
>> }
>>
>> } | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture