none
Windows PowerShell Classifier (FCI) 2012 R2

    Question

  • Hi folks,

    I'm busy implementing FSRM FCI to classify files using PowerShell. The Windows PowerShell Classifier module is integrated in Windows 2012 R2. So when I launch the fsrm.msc I am able to choose the module and in a new popup window I can paste a PowerShell script for classification to do fancy stuff.

    No I am able to set a string value from script, but when I try to use the examples from the SDK (f.i. '$propertyBag.Name' or '$PropertyBag.RelativePath'  no value is being returned. Also when I write to Windows Eventlog nothing is being written.

    The following command was actually working from the PowerShell script:
    Write-EventLog -LogName MM-log -Source MM-Powershell -Message "test message" -EventId 0 -EntryType information

    Can anyone post examples how to use the module in Windows 2012? Do I need to change begin{} also? In the examples only the process{} part is given (http://blogs.technet.com/b/filecab/archive/2009/08/14/using-windows-powershell-scripts-for-file-classification.aspx)

    In C# you need to get the name in "public void OnBeginFile". But then only "Name" is working and being returned. I was not able to get the path of the file being classified.

    I really need to do some classification before uploading files to SharePoint. Hope someone can help me out.

    **
    What I can do in PowerShell ISE (working)

    # Set the value of the "Demo" property to "DemoValue2"
    #$cm.SetFileProperty("C:\FCItest\Demo\pwsdemofile.txt", "Demo", "DemoValue2")#

    # Get and display the value of the "Demo" property
    #$Demo = $cm.GetFileProperty("C:\FCItest\Demo\pwsdemofile.txt", "Demo", 0)
    #Write-Host $Demo.Value

    **
    What I can do in FSRM (working)

    $PropertyBag = $_            
    $FileName = $PropertyBag.Name            
    $FilePath = $PropertyBag.RelativePath            
    $SpecialString = ‘Confidential’            

    -> Value 'Confidential' is being returned and set to the property chosen in the FCI rule

    **
    What should working in FSRM but not returning any values (example from SDK: C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\winbase\FSRM\PowerShellHostClassifier\CS\powershell_scripts\demo_script)

    process{
     $propertyBag = $_

     #get the file name
     $fileName = $propertyBag.Name


     if($fileName -like "*.txt")
     {
      #set the property to the name without .txt
      $fileName.Substring(0, $fileName.Length-4 )
     }
    }

    Thursday, June 12, 2014 10:50 AM

Answers

All replies

  • Hi Christiaan,

    Based on my research, the " FSRM PowerShell host classifier" listed in the article you posted isn't applied to server 2012, to classify the files before uploading to Sharepoint in powershell, please check this article:

    Solution: Powershell + File Classification Infrastructure

    If you have any feedback on our support, please click here.

    Best Regards,

    Anna

    TechNet Community Support

    Sunday, June 15, 2014 8:25 AM
  • Hi Anna,

    Thanks for your reply.

    I have read the full article and the creation of rules using PowerShell was really helpfully to me!! For rules based on a file location I am sure I will use it.

    But I don't want to create rules for every single situation. I would like to implement some logic into it using scripts.

    I have opened a support call with Microsoft. I think its at development right now. I hope they can provide me with some samples how to use the module which is build into 2012. FSRM can take care of opening files in multiple streams. I don't want to write that myelf when its already there.

    Best regards,
    Christiaan


    Monday, June 16, 2014 10:33 AM