Hi,
I am unable to get output from importing csv. There is no error in the output.
Please help.
$VMs = Import-Csv -Path .\Test_OS_Info.csv
$VmInfo = ForEach ($VM in $VMs)
{
$VM.Extensiondata.Guest.Disk | Select @{N="Name";E={$VM.Name}},
@{N="IPAddress";E={$VM.guest.IPAddress[0]}},
@{N="VM PowerState";E={@($VM.PowerState)}},
@{N="Operating System"; E={@($VM.guest.OSFullName)}},
@{N="Folder";E={$VM.Folder.Name}},
@{N="MountPoint";E={$_.DiskPath}},
@{N="Capacity(GB)";E={[math]::Round($_.Capacity/ 1GB)}},
@{N="FreeSpace(GB)";E={[math]::Round($_.FreeSpace / 1GB)}},
@{N="FreeSpace(%)";E={[math]::Round(((100* ($_.FreeSpace))/($_.Capacity)),0)}},
@{N="UsedSpace(GB)";E={[math]::Round(((($_.Capacity / 1GB))-($_.FreeSpace / 1GB)),0)}} | where {($_.DiskPath -Match 'C:')}
}
$VmInfo
Contents of .CSV
"Folder","Name"
"Test","BACKUPVM"
"Test","APP27"