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
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.
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.
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):
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.