$ldiskItems = get-wmiobject -class "Win32_LogicalDisk" -namespace "root\CIMV2" -comp (gc C:\pscripts\Input\VM_OverBook.txt) @(foreach ($objLItem in $ldiskItems) { write-output "Logical Disk Info ------------------------------------------------`n" write-output "Disk : $($objLItem.Caption)`n" write-output "Volume Name : $($objLItem.VolumeName)`n" write-output "Size : $($objLItem.Size)`n" $lkbSize = $objLItem.Size / 1024 / 1024 / 1024 write-output "In GB : $($lkbSize)`n" write-output "Used Space : $($objLItem.usedpace)`n" $ukbSize = $objLItem.Size / 1024 / 1024 / 1024 write-output "In GB : $($ukbSize)`n" write-output "" }) | out-file C:\pscripts\output\info.csv -enc ASCII -append