Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trying to populate a CSV with drive info

$
0
0

Hi All - this seems so simple, but I cannot seem to get the output from this tiny script to show up in a CSV like it does on the host. I know I am looking at an output formatting issue, but that always seems to be a bugaboo with me. here is what I have:

$disks=gwmiwin32_logicaldisk-filter"drivetype=3"

 

 

foreach ($diskin$disks) {

 

 

$size="{0:0.0}GB"-f ($disk.size/1gb)

 

 

Write-Host$disk.deviceid $Size

}

What I need is the output (currently as Write-Host line) to populate a CSV cell with the same formatting (or at least similar) that displays size of each Type "3" drive next to the Drive Letter for the machine.

Also, does anyone have any suggestions for reference material (Books for purchase) that covers the challenges of formatting thoroughly? thank you in advance.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles