Share via


File Server Resource Manager: Creating a custom classification module - Registration

Hello everyone,

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:

  1. Register the class library in the Global Assembly Cache
  2. Register the class library as a COM server
  3. 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 (https://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.

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"
    • 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: DoesPropertyValueApply or GetPropertyValueToApply

 

In the final part of this mini-series I will show you how to execute our custom classification module.

Cheers,

Helge Mahrt