Hi All,
Thanks is advance.
I am trying to get the deatils of vm and its datastore name,freespaceGB to n csv file. After excuting it I am getting only the out put of the last vm from my list. Hope I missed some thing in appending the output. Can any one please help.
Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer 192.168.1.125
##VMname.csv having list of vms ####
$vm = Import-csv c:\scripts\vmname.csv
foreach ($line in $vm) {
Get-datastore -vm $line.name | Select-Object $line.name,name,FreeSpaceGB | Export-Csv c:\scripts\ds.csv -NoTypeInformation
}
The output is which i am looking is some thing like this.
Virtal machine DS name FreeSpace
VM1 DATA1 13GB