Thanks for responding mattboren
Yes I was referring to Vm & i use in error Host word. I should have been giving more info if i need precise answer from experts :smileyhappy:
Your 1 liner looks smarter way to do it !
I was also looking at (|
Out-Null
) as one way to do it with my one liner..
===
I was writing below Qution actually in vSphere PowerCLI Forum - VMware Developer Center but was giving me error, as soon as I submit, it says "your post deleted"
===
Hello All,
Need a small help, i am missing a small catch in my script.
I have a bunch of VMs & i need to check if they really exits in our vcenter env. I have the big list in a csv file.
Here is my code
input file :vm.csv
host ip
xxx 10.xx
xxx 10.xxx
============================================================================================================
$csv = Import-Csv C:\temp\vm.csv
PowerCLI C:\temp> foreach ($line in $csv) { Get-VM $($line.host) |export-csv c:\temp\960-$(line.host).csv}
============================================================================================================
as most of the VMs do not exits & hence the final file is empty & also its empty coz i suspect the code do not have sleep stetement .. not the smart script .. infact the file name does not take the vm name ( ie c:\temp\960-$(line.host).csv)
Can someone pls give a fix..
Pls note there are few vms do exist (i checked manually)
Thanks