Eri*_*dke 5 windows powershell powershell-3.0
我正在尝试为计算机上的每个hdd卷获取各种属性.
我正在使用cmdlet get-volume,然后通过它foreach,但Windows Server 2008中不存在该cmdlet.:(
有人知道另一种选择吗?
我只需要驱动器号,objectId/guid,可用空间,总空间和每个卷的名称.
WMI类Win32_Volume包含您要查找的信息
Get-WMIObject -Class Win32_Volume | Select DriveLetter,FreeSpace,Capacity,DeviceID,Label
Run Code Online (Sandbox Code Playgroud)
哪一个花哨的步法,你可以使驱动器空间属性看起来更有吸引力.
Get-WmiObject -Class Win32_Volume |
Select DriveLetter,
@{Label="FreeSpace (In GB)";Expression={$_.Freespace/1gb}},
@{Label="Capacity (In GB)";Expression={$_.Capacity/1gb}},
DeviceID,Label |
Format-Table -AutoSize
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10609 次 |
| 最近记录: |