From time to time, I get tickets where one of many possible root causes may be a full disk. While accessing this information over RDP is often an option, it is rather more intrusive than needed. What’s more, I usually don’t have access to access file servers over RDP. Enter PowerShell and the get-WmiObject
query!
By using the Win32_LogicalDisk
class, and specifying the computer I want to access with the -ComputerName
parameter, I get the information readily enough. The complete query looks like this:
get-WmiObject win32_logicaldisk -Computername ComputerID
The output looks like this:
As you can see from the screenshot above, the output returns FreeSpace
in Bytes. Divide by 1’024, 1’048’576, or 1’073’741’824 to get available space in KB, MB, or GB, respectively (though a thousand, a million, and a billion should get you close enough for government work).
You might also note that the output lists ALL mapped drives, including mapped network drives, which means that the command is also useful to see whether a drive is mapped, and whether it’s mapped correctly.
By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.