• Who is draining your file server storage space? 【转载】【翻译】


    By Jabez Gan, ZDNet Asia
    Tuesday, August 22, 2006 05:10 PM

    The File Server Resource Manager feature in Windows Server 2003 helps system administrators keep track and set storage quotas.
    Have you ever noticed that your file server storage space has quickly run out after upgrading the file server storage device?

    Your management might say: "Our employees are doing a great job! They are doing loads more work!" But have you ever wondered what is actually stored in the server? Are they all work related files?

    While working on a freelance basis for IT departments in many small companies, I have found, on browsing the file server, that computer users store non-work related files like MP3 or video files.

    Although I don't personally mind that computer users store these files temporarily for the occasional viewing, it is not acceptable when each employee stories his or her own collection of music, jokes or videos without deleting them from time to time.

    System administrators can save time spent monitoring the file types that users have by using the File Server Resource Manager (FSRM) which is a feature in Windows Server 2003 R2.

    File Server Resource Manager offers: one, quota management; two, file screening; and three, storage report.

    In this article, I'll show how you can extend FSRM.

    In the current version of FSRM, which is included in R2, there is no public SDK. It provides four different ways for a developer to "express" themselves by:

    • Using the FSRM command line tools to develop configuration scripts
    • Using an executable as a notification action for quota or screening (configurable through the GUI of FSRM)
    • Listening to the WMI events which FSRM sends for quota/screening notifications
    • Writing an application which parse FSRM reports in XML or SCV format and adds extra value

    Method 1:
    FSRM command line tools include (located under %windir%\system32):

    • Dirquota.exe--Quota Management
    • Filescrn.exe--File Screening
    • Storrept.exe--Storage Reports

    Here is a scenario: As a developer, you are told to create a custom application to ease the administrator's repetitive tasks. For developing this custom application, I would recommend Visual Studio 2003/2005.

    Not going too deep into Visual Studio, I'll show you some sleek scenarios that the administrator would want the developer to create.

    Let's say you want to generate storage reports in XML format and have your custom application parse the XML file (you can use system.diagnostics.process class when coding the custom application through VS .NET, but in this example I'll keep things simple and give a Command Prompt format) :

    C:\>storrept reports generate /ondemand /report:mostrecentlyaccessed /scope:%userprofile% /format:xml

    The above will generate the XML immediately with the search scope in the environment path %userprofile%, and the resulting XML file will be saved under %systemdrive%:\StorageReports\Interactive.

    There are many tags that you can parse into your application.

    On parsing the XML file with Visual Basic .NET, we can use either .NET Framework which includes XmlTextReader, XmlDocument, XmlSerializer, DataSet and XpathDocument. Again, this isn't a tutorial on parsing XML, so I'll leave that out for your research.

    "We hire many newbies on a monthly basis!" This is another common scenario! Creating quotas will be another repetitive task for the administrator, so to ease his job, the custom application can take the username of the new user account created and run a command (or script through the custom application):

    C:\>dirquota quota add /path:"C:\documents and
    settings\newbie1\My Documents?/limit:50MB /type: hard

    See ma! This newbie1 user will not be able to use up our space!

    The above will add a new quota to the My Documents folder of user newbie1 with a folder quota of 50MB. If the above command doesn't suit you, you can actually modify the parameters through your custom application.

    Method 2:
    If you want an executable to run as a notification, this can be done all from the GUI of FSRM. But if you have many quotas configured, it isn't recommended that you use the GUI as it chokes up the system. Use the command line tools instead.

    Method 3:
    What about extending through WMI (Windows Management Instrumentation)? Good news and bad news: There is only support for WMI notifications but not WMI Management Interfaces. What does this mean? You will only be able to use WMI to monitor FSRM's notifications and not manage FSRM through WMI.

    Here is a link to get you started on playing with WMI and FSRM through Monad (now renamed to Windows PowerShell):
    http://mow001.blogspot.com/2006/01/watching-fsrm-quota-and-filescreen.html

    Method 4:
    Storage Reports support XML and CSV formats which allow extensibility. You can create some scheduled tasks to get the XML/CSV reports created and use your custom application to parse the XML or CSV files. We briefly touched on this topic in Method 1 above.

    With just this single feature of R2, you should be able to identify the user who is using the most storage space in your file server.

    Click on these links for more information about FSRM; XML File Parsing in VB.NET; and .NET Framework Class Library: System.Diagnostics.Process

    Jabez Gan has been working on computers (clients and servers) on a freelance basis since he was 14 years old. An author for a Microsoft related blog (http://www.msblog.org), Gan specializes in Windows Server File System and is a Microsoft MVP (Most Valuable Professional). Gan is currently a student majoring in Computer Science at the University of Nottingham.

     

     

    我的简短翻译

    本文是针对Windows Server 2003 R2中的一个文件服务器资源管理的功能,列出了四种方式

    1. 直接调用命名行工具(一共四个)

    Dirquota: http://go.microsoft.com/fwlink/?LinkId=92741
    Filescrn: http://go.microsoft.com/fwlink/?LinkId=92742
    Storrept: http://go.microsoft.com/fwlink/?LinkId=92743

    Schtasks.exe to schedule the tasks.

    这三个工具就可以做所有的事情

    2. 使用图形化界面 FSRM。这是一个基于MMC3.0的工具

    image

    3.通过WMI,但要注意,WMI只可以进行查询,但不可以进行操作

    win32_quotalimitevent
    win32_quotathresholdevent
    win32_filescreenevent
    win32_quotaevent

    4.在报表这个部分,因为它可以生成XML或者CSV的格式报表,那么就可以在这个基础上做一些扩展和开发。

  • 相关阅读:
    二元函数求一定区间上的最大值问题
    LOF异常检测算法实现
    失效项目总代码汇总
    layui弹出层layer.open 中的content问题
    分治算法基本原理和实践
    Android 文件存储浅析
    详解 CmProcess 跨进程通信的实现
    View Animation 运行原理解析
    margin-top失效及解决办法
    vue自定义移动端touch事件之点击、滑动、长按事件
  • 原文地址:https://www.cnblogs.com/chenxizhang/p/1323024.html
Copyright © 2020-2023  润新知