如何查看2008R2上挂载点驱动器的大小?

如何查看2008R2上挂载点驱动器的大小?

大小列告诉我驱动器的容量但没有告诉我使用的磁盘量。

如何确定 2008 R2 中挂载点上有多少数据?任何 GUI 或 powershell 命令都可以。

答案1

get-wmiobject Win32_volume |select Name,Capacity,Freespace

这将为您提供所有内容的列表,包括挂载点及其容量。

至于 GUI,它只是有点隐蔽。当您转到挂载点本身的属性时,第一页上有一个按钮,它会为您提供与 C: 等根目录相同的磁盘统计信息。

答案2

您还可以看看这个 powershell 脚本:

http://www.powershellcave.com/?p=25

事实证明,当监控大量挂载点时它非常方便。

下面的脚本

#############################################
#
# POWERSHELLCAVE.COM
# NAME: Mountpoint Monitoring
# Author: Caveman
# Summary: returns returnstate number that identifies state, replace with 
# any desired message you would like to have in your monitoring system.
#
# Version
# 19-02-2013   Initial version 
# 20-02-2013   Production version 1.0
#############################################

$maxmount="10"$mediummount="15"$returnStateOK=0$returnStateWarning=1$returnStateCritical=2$returnStateUnknown=3$TotalGB= @{Name="Capacity(GB)";expression={[math]::round(($_.Capacity/1073741824),2)}}
$FreeGB= @{Name="FreeSpace(GB)";expression={[math]::round(($_.FreeSpace /1073741824),2)}}
$FreePerc= @{Name="Free";expression={[math]::round(((($_.FreeSpace /1073741824)/($_.Capacity /1073741824)) *100),0)}}

$volumes=Get-WmiObjectwin32_volume | Where-object {$_.DriveLetter -eq$null}
$points= @($volumes | Select SystemName, Label, $TotalGB, $FreeGB, $FreePerc) 

foreach ($entryin$pionts){
    if ($entry.Free -le$maxmount){
    $message="System"+""+$entry.SystemName +""+" mountpoint "+$entry.label+""+"has"+""+$entry.Free +"%"+"  free space available"Write-Host$message
    exit $returnStateCritical
    }
    elseif ($entry.Free -le$mediummount){
    $message="System"+""+$entry.SystemName +""+" mountpoint "+$entry.label+""+"has"+""+$entry.Free +"%"+"  free space available"Write-Host$message
    exit $returnStateWarning
    }
    else { 

        Write-Host"OK"
        exit $returnStateOK
        }
}

相关内容