Мониторинг свободного места на диске
function funline ($strIN) { $num = $strIN.length for($i=1 ; $i -le $num ; $i++) { $funline = $funline + "=" } Write-Host -ForegroundColor yellow $strIN Write-Host -ForegroundColor darkYellow $funline } $arycomputer = "localhost", "loopback" foreach($computer in $arycomputer) { $volumeSet = Get-WmiObject -Class win32_volume -computer $computer ` -filter "drivetype = 3" foreach($volume in $volumeSet) { $drive=$volume.driveLetter [int]$free=$volume.freespace/1GB [int]$capacity=$volume.capacity/1GB funline("Drives on $computer computer:") "Analyzing drive $drive $($volume.label) on $($volume.__server)" "`t`t Percent free space on drive $drive " + "{0:N2}" -f ` (($free/$capacity)*100) } }
Голосов пока нет
Оставить комментарий