Powershell: Get free diskspace remote computer

Run this oneliner to get computer free disk space

$computername = COMPUTERNAME
$cred = Get-credential

Get-WmiObject Win32_LogicalDisk -ComputerName $computername -Credential $cred | Format-Table DeviceId,@{n="Size";e={[math]::Round($_.Size/1GB,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1GB,2)}} -AutoSize

Leave a Reply

Your email address will not be published.