Hello, I don't work for me... Here is the script that i use: (concatenated from every discuss about this post and based on content file) $names = Get-Content -Path .\vmnames.txt $regexNames = $na...
See more...
Hello, I don't work for me... Here is the script that i use: (concatenated from every discuss about this post and based on content file) $names = Get-Content -Path .\vmnames.txt $regexNames = $names.Foreach{"^$($_)$"} -join '|' Get-View -ViewType VirtualMachine -Filter @{'Name'=$regexNames;'Runtime.PowerState'='poweredOn'} @{N='IPAddress';E={$_.Guest.ipAddress}}, @{N='Gateway';E={($_.Guest.ipstack.iprouteconfig.iproute.gateway.ipaddress | where{$_ -ne $null}) -join '|'}}, @{N='SubnetMask';E={ $ipAddr = $_.Guest.ipAddress @(($_.Guest.Net.ipconfig.ipaddress | where{$ipAddr -contains $_.IpAddress -and $_.PrefixLength -ne 0}).PrefixLength | %{ [IPAddress]$ip = 0; $ip.Address = (([UInt32]::MaxValue) -shl (32 - $_) -shr (32 - $_)) $ip.IPAddressToString }) -join '|' }}, @{N='DNS';E={[string]::Join(',',($_.Guest.IpStack.DnsConfig.IpAddress))}}, @{N='MacAddress';E={($_.Config.Hardware.Device | where{$_ -is [VMware.Vim.VirtualEthernetCard]}).MacAddress -join '|'}}, @{N='VlanId';E={ $folder = Get-View -Id $_.Parent -Property "[VirtualMachine]ChildEntity.Network.*" ($folder.LinkedView.ChildEntity.where({$vm.MoRef -eq $_.MoRef})).LinkedView.Network.Name}}, @{N='Network Adapter';E={$_.Config.Hardware.Device | Where {$_ -is [VMware.Vim.VirtualEthernetCard]} | ForEach {$_.GetType().Name.Replace('Virtual','')}}} | ...But result is very strange : See capture joined Have an idea ? Thanks