Disk space from bulk computers



I’ve got the script which provides disk space on remote computers:

Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName PC1 -Filter DriveType=3 |
Select-Object DeviceID,
@{'Name' = 'Size (GB)'; 'Expression' = { [string]::Format('{0:N0}', [math]::truncate($_.size / 1GB)) } },
@{'Name' = 'Free (GB)'; 'Expression' = { [string]::Format('{0:N0}', [math]::truncate($_.freespace / 1GB))}},
@{'Name' = '(%)'; 'Expression' = { [string]::Format('{0:P}', $_.freespace / $_.Size )}}

how can i use it on a bulk computers? better to export a csv file for better visual results.

I’ve tried coma separate on the computer name but it didn’t work.


Thanks in advanced.

What exactly does that mean? I’d recommend to add a property to get the name of the computer but an array for the parameter -ComputerName works just fine.