我已经管理一台普通的 SBS 2003 服务器好几年了。我们的网络策略是将用户配置文件和“我的文档”文件夹存储在服务器上。最近,服务器磁盘已满,每隔几周运行一次 WinDirStat 让我能够通过识别大文件并单独处理它们来解决这个问题。
是否有一个监控工具可以主动查找大文件(最近创建),并内置报告/通知系统,以便在创建大文件(可能> 100mb)时 ping 我?
或者是否存在一个程序/脚本来过滤文件和文件夹,以便按照文件创建时间与文件大小更重要的方式对它们进行排序?
我搜索了一番,没有找到可以执行上述操作的 Windows 工具。
答案1
文件服务器资源管理器将完成您所寻找的工作。
如何在 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