Using Powershell, you can use the following command:
Get-WmiObject -Class win32_logicalDisk -ComputerName server1, server2, server3, etc | Select-Object pscomputername, deviceid, freespace, size
Replace server1, server2, etc with the remote server names or IPs.
The output looks like this:
![enter image description here](../../I/static/images/4179be19b28aa6f8cdff4048b0931193d546f47c2c68c8d6beec9a6ff9eb759f.png)
If you want, you can add | Export-Csv -Path .\drives.csv
to the end of the script to output the file to a comma separated value (CSV) file for use with Excel. If you do, when you you open Excel you will need to format the drive size columns in Excel as numbers.
Just for giggles, I wrote this PowerShell script that will perform the task on all servers in Active Directory:
$ErrorActionPreference= 'silentlycontinue'
Get-ADComputer -Filter 'OperatingSystem -like "*Server*"' -Properties * | Select-Object Name |
ForEach-Object {
If (Test-Connection $_.Name -Count 1){
Get-WmiObject -Class win32_logicalDisk -ComputerName $_.Name |
Select-Object pscomputername, deviceid, freespace, size
}
else {
Write-host $_.Name " Connection Error"
}
}
FYI, this will require administrative credentials. – Bink – 2019-10-29T15:53:08.753