Chris_95's Posts

Hello again LuD ! Thanks for your reply. In fact : many days to try to understand why my very simple script didn't work : $vmlist = Get-Content -Path "C:\Powercli\Powercli_VMWARE\Scripts\Checked\v... See more...
Hello again LuD ! Thanks for your reply. In fact : many days to try to understand why my very simple script didn't work : $vmlist = Get-Content -Path "C:\Powercli\Powercli_VMWARE\Scripts\Checked\vmnames.txt" foreach($vmname in $vmlist){ Get-VM -Name $vmname } The error message : (see many many times in forum...) The real reason of this trouble IS NOT THE SCRIPT but the file format about... TXT FILE ! YES be careful that the response file is well written in UTF-8 FORMAT !      
Hello, What is the solution to pass multiple VM in txt file ? Thanks for return.  
Sorry LucD, I'm taking too much of your time, it's already a lot of solicitation and exchange ! Thanks so much
OK but vLANID area is still empty  
...sorry for the last message where i I did not post the error message. See attach file
Hello LucD, Thanks so much to help me !  I modified the script with the command line that you writed but i obtained error message  
Sorry LucD to be a little bit perfectionist but when i have multiple network card, informations doesn't appear. I can have up to 8 network cards. Thanks for reply  
...just a remark before closing the subject, the vLAN area is empty whereas it exists well . See attach file
Thanks so much LucD ! Dont' know why some special characters have disappeared. Have a nice day
Here is the script that i post previously... the same $names = Get-Content -Path .\vmnames.txt $regexNames = $names.Foreach{"^$($_)$"} -join '|' Get-View -ViewType VirtualMachine -Filter {'Name'=$... See more...
Here is the script that i post previously... the same $names = Get-Content -Path .\vmnames.txt $regexNames = $names.Foreach{"^$($_)$"} -join '|' Get-View -ViewType VirtualMachine -Filter {'Name'=$regexNames;'Runtime.PowerState'='poweredOn'} | Select @{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','')}}}|
Hello LucD Thank you very much for the quick reply, but it still doesn't work... I repeat that I did not invent this script but just copy/paste from YOUR script! So if you wrote that there is an e... See more...
Hello LucD Thank you very much for the quick reply, but it still doesn't work... I repeat that I did not invent this script but just copy/paste from YOUR script! So if you wrote that there is an error, this script is not functional. Regards, See attach file
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