This is part 3 of my mini-series on how to create a custom file classification module that can be run by the File Server Resource Manager which ships with Windows Server 2008 R2. (If you missed the other parts, you can return to the index by clicking here)
Registering the Classification Module
The registration is done in three steps:
- Register the class library in the Global Assembly Cache
- Register the class library as a COM server
- Register the class COM server as a classification module with the FSRM
Very important: The FSRM is a 64bit service. Please make sure you execute the following commands from the 64bit version of the Visual Studio command line.
Register with the Global Assembly Cache
To register our class library with the GAC we just need to execute the following command:
gacutil /I <class library> /f” (Replace <class library> with the path + filename of your class library)
To add an assembly to the GAC it needs to be signed with a strong name. During development this can be quite bothersome. You can skip this by using the Strong Name Tool (http://msdn.microsoft.com/en-us/library/k5b5tt23(v=VS.71).aspx) (CAUTION Use this option only during development. Adding an assembly to the skip verification list creates a security vulnerability. A malicious assembly could use the fully specified assembly name (assembly name, version, culture, and public key token) of the assembly added to the skip verification list to fake its identity. This would allow the malicious assembly to also skip verification.)
Register as COM server
Registering our class library as a COM server is even simpler:
regasm <class library>” (Replace <class library> with the path + filename of your class library)
Register with the File Server Resource Manager
Finally we need to tell the FSRM about the existence of your module. The easiest way is to save the following code in a *.vbs file and to execute this file from an elevated command prompt.
Please pay special attention to the following lines:
module.ModuleClsid = "B99FC137-4934-40C5-BB31-04C04B201479"
- This has to correspond to the GUID attribute that we defined for our class
module.NeedsExplicitValue = false
- This defines which of the following two functions is called:
In the final part of this mini-series I will show you how to execute our custom classification module.