Just pick out the SystemName property as well, and you'll get a result like this.
Get-WMIObject win32_diskdrive -computer (Get-Content C:\Temp\DiskDrives\Computers.txt) | `
Select SystemName,model
>SystemName Model Size(GB)
---------- ----- --------
BEHEMOTH OCZ-VERTEX PLUS R2 58
BEHEMOTH JetFlash Transcend 32GB USB Device 29
BEHEMOTH INTEL SSDSC2CT180A3 168
BEHEMOTH SAMSUNG HD103SJ 932
BEHEMOTH OCZ-VERTEX 60
BEHEMOTH ST3000DM001-1CH166 2795
BEHEMOTH OCZ-VERTEX PLUS R2 58
BEHEMOTH JetFlash Transcend 32GB USB Device 29
BEHEMOTH INTEL SSDSC2CT180A3 168
BEHEMOTH SAMSUNG HD103SJ 932
BEHEMOTH OCZ-VERTEX 60
BEHEMOTH ST3000DM001-1CH166 2795
As soon as you run a WMI query against more than one machine, you also get the SystemName parameter too, which makes this easy!
Note that in my above result, I've got a small drive called Transcend, which is a 32 GB USB 3 FlashDrive. You mentioned wanting to include only Fixed disks, not USB, so to do that we just add in a Where Statement, like this:
PS C:\> Get-WMIObject win32_diskdrive -ComputerName behemoth,localhost |
Where-Object MediaType -eq 'Fixed hard disk media' | Select SystemName,Model
>SystemName Model Size(GB)
---------- ----- --------
BEHEMOTH OCZ-VERTEX PLUS R2 58
BEHEMOTH INTEL SSDSC2CT180A3 168
BEHEMOTH SAMSUNG HD103SJ 932
BEHEMOTH OCZ-VERTEX 60
BEHEMOTH ST3000DM001-1CH166 2795
BEHEMOTH OCZ-VERTEX PLUS R2 58
BEHEMOTH INTEL SSDSC2CT180A3 168
BEHEMOTH SAMSUNG HD103SJ 932
BEHEMOTH OCZ-VERTEX 60
BEHEMOTH ST3000DM001-1CH166 2795
Bonus points, if you want to show the size of the disk in GB, change your select statement to this, which uses a calculated property to make a new column called Size(GB) and populate it with the $_.Size property divided by 1GB in integer (whole number) form :
Select SystemName,Model,@{Name='Size(GB)';Exp={$_.Size /1gb -as [int]}}`
Completed One-Liner
Simply add your Export-CSV to the end of the pipeline to have a completed one-
liner like this which should give you the results you're looking for:
Get-WMIObject win32_diskdrive -computer (Get-Content C:\Temp\DiskDrives\Computers.txt) |
Where-Object MediaType -eq 'Fixed hard disk media' |
Select SystemName,Model,@{Name='Size(GB)';Exp={$_.Size /1gb -as [int]}} |
Export- CSV "C:\Temp\DiskDrives\Machines.csv"
Ahh, the Power of PowerShell.
invoke-command
and use pipeline andout-file c:\example.csv