WMI能轻松的查询和获得你本地机器的磁盘信息(加上-Computername将能获得远程电脑):
PS C:\> Get-WmiObject -Class Win32_LogicalDisk DeviceID : C: DriveType : 3 ProviderName : FreeSpace : 61008658432 Size : 185553907712 VolumeName : DeviceID : E: DriveType : 3 ProviderName : FreeSpace : 25018523648 Size : 41943035904 VolumeName : .....
只查询硬盘和硬盘剩余大小只小于某个范围的,请尝试:
$limit = 50GB Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3 and Freespace<$limit" | Select-Object -Property VolumeName, Freespace, DeviceID <# 输出: VolumeName Freespace DeviceID ---------- --------- -------- 25018523648 E: 40607748096 G: #>
原文地址:Finding Hard Drives Running Low on Storage
本文链接: https://www.pstips.net/finding-hard-drives-running-low-on-storage.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!