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)
The registration is done in three steps:
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)
gacutil /I <class library> /f
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)
regasm <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.
Dim classMan Dim parameters(0) Dim module set classMan = CreateObject( "Fsrm.FsrmClassificationManager") parameters(0) = "StaticModuleName=File Name Classifier" set module = classMan.CreateModuleDefinition(2) module.ModuleClsid = "B99FC137-4934-40C5-BB31-04C04B201479" module.Name = "File Name Classifier" module.Enabled = true module.Account = 3 module.NeedsExplicitValue = false module.Parameters = parameters module.Commit()
Please pay special attention to the following lines:
module.ModuleClsid = "B99FC137-4934-40C5-BB31-04C04B201479"
module.NeedsExplicitValue = false
In the final part of this mini-series I will show you how to execute our custom classification module.