Monitoring

是否有程序/工具/腳本來監視或查看在 Windows 伺服器上創建的所有最近 * 大 * 文件?

  • June 12, 2013

多年來,我一直在管理一台普通的 SBS 2003 伺服器。我們的網路策略設置為在伺服器上儲存使用者配置文件和“我的文件”文件夾。最近伺服器磁碟已滿,每隔幾週執行一次 WinDirStat 使我能夠通過辨識大文件並單獨處理它們來解決問題。

是否有一個監控工具可以主動查找大文件(最近創建的)並內置報告/通知系統,以便在創建大文件時對我進行 ping 操作(可能 > 100mb?)

或者是否有一個程序/腳本來過濾文件和文件夾,從而以一種在文件創建時間和文件大小上很重的方式對它們進行排序?

我四處搜尋,找不到執行上述操作的 Windows 工具。

文件伺服器資源管理器將滿足您的需求。

如何在此處安裝 SBS 2003 R2 。

你會想要創建一個File Screen Template並從那裡開始: 在此處輸入圖像描述

這也可以使用 Powershell 腳本來完成,它也應該適用於您:

   #------------------------------------------------------------
# LargeFiles.CSV
# Server = Server name without any slashes. Full UNC name can be used
# Path = Can be any path but if you are using the administrative shares be
#        sure to use the "$"
#        Example:) L$\share\path\folder\etc or L$
#------------------------------------------------------------
#Get-ChildItem L:\ -Recurse | Where-Object {$_.Length -gt 10GB} | Select-Object @{Name="GB";Expression={$_.Length / 1GB}},Name

$FromAddress = "FromEmailAddress"
$ToAddress = "ToEmailAddress"
$MessageSubject = "Large Files Found"
$SendingServer = "SMTPServer.domain.local"

function CreateLargeFilesCSV
{
Write-Host "--------------------------------------------------------`r" -foreground yellow
Write-Host "The LargeFiles.csv file did not exist. This was created for you.`r" -foreground yellow
Write-Host "You must now populate this file with the proper information,`r" -foreground yellow
Write-Host "See files for more details.`r" -foreground yellow
New-Item LargeFiles.csv -type file
Add-Content LargeFiles.csv "Server,Path"
Add-Content LargeFiles.csv "SQL1,I$"
Add-Content LargeFiles.csv "SQL1,K$\Sharename\folder\etc"
}

function CheckSize
{
   foreach ($result in $results)
   {
       $strServer = $result.Server
       $strServer = "\\$strServer\"
       $strPath = $result.Path
       $strPath = "$strPath"
       $strMaxFileSize = $result.MaxFileSize
       Get-ChildItem $strServer$strPath -Recurse | Where-Object {$_.Length -gt 10GB} | Select-Object Name,@{Name="Size(GB)";Expression={"{0:N2}" -f ($_.Length/1GB)}},@{Name="Server";Expression={$strServer}},@{Name="Path";Expression={$strPath}} | ConvertTO-HTML | Format-Table -AutoSize | Out-File Results.txt -append
   }
}

if (Test-Path LargeFiles.csv)
{
   $Results = Import-CSV LargeFiles.csv | Select Server,Path
   CheckSize
}
else
{
   CreateLargeFilesCSV
}

$Answer = Get-Content Results.txt | Select-String "</colgroup>" -quiet

If ($Answer -eq $true)
{
   Write-Host "Found some large files"
   $MessageBody = (Get-Content Results.txt | out-string)
   $MessageBody = "Found some large files. Below is a list of these files`n$MessageBody"
   Remove-Item Results.txt

   ###Create the mail message
   $SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
   $SMTPMessage.IsBodyHTML = $true

   ###Send the message
   $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
   $SMTPClient.Send($SMTPMessage)
}
Else
{
   Write-Host "Nothing to send"
   Remove-Item Results.txt
}
- See more at: http://it-erate.com/hunting-alerting-large-files-powershell/#sthash.XI56yxdl.dpuf

引用自:https://serverfault.com/questions/515347