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 )
}
}