IFsrmSetting interface

Used to configure FSRM.

To get this interface, call the CoCreateInstanceEx function. Use CLSID_FsrmSetting as the class identifier and __uuidof(IFsrmSetting) as the interface identifier.

Members

The IFsrmSetting interface inherits from the IDispatch interface. IFsrmSetting also has these types of members:

Methods

The IFsrmSetting interface has these methods.

MethodDescription
EmailTest

Send a test email to the specified email address.

GetActionRunLimitInterval

Gets the time that an action that uses the global run limit interval must wait before the action is run again.

SetActionRunLimitInterval

Sets the time that an action that uses the global run limit interval must wait before the action is run again.

 

Properties

The IFsrmSetting interface has these properties.

PropertyAccess typeDescription

AdminEmail

Read/write

Retrieves or sets the email address for the administrator.

DisableCommandLine

Read/write

Retrieves or sets a value that determines whether FSRM prevents command line actions from running.

EnableScreeningAudit

Read/write

Retrieves or sets a value that determines whether FSRM keeps audit records of the file screen violations.

MailFrom

Read/write

Retrieves or sets the default email address from which email messages are sent.

SmtpServer

Read/write

Retrieves or sets the SMTP server that FSRM uses to send email.

 

Remarks

To create this object from a script, use the program identifier, "Fsrm.FsrmSetting".

Examples

The following example shows how to retrieve the properties of this interface.


#ifndef UNICODE
#define UNICODE
#endif


#include <windows.h>
#include <stdio.h>
#include <comutil.h>
#include <fsrm.h>       // FSRM base objects and collections
#include <fsrmtlb_i.c>  // contains CLSIDs


//
// Print the FSRM configuration settings.
//
void wmain(void)
{
  HRESULT hr = 0;
  IFsrmSetting* pSettings = NULL;
  BSTR bstr = NULL;
  VARIANT_BOOL boolVal = VARIANT_FALSE;
  long interval = 0;

  hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
  if (FAILED(hr))
  {
    wprintf(L"CoInitializeEx() failed, 0x%x.\n", hr);
    exit(1);
  }

  hr = CoCreateInstance(CLSID_FsrmSetting, 
                        NULL,
                        CLSCTX_LOCAL_SERVER,
                        __uuidof(IFsrmSetting),
                        reinterpret_cast<void**> (&pSettings));

  if (FAILED(hr))
  {
    wprintf(L"CoCreateInstance(FsrmSetting) failed, 0x%x.\n", hr);
    if (E_ACCESSDENIED == hr)
      wprintf(L"Access denied. You must run the client with an elevated token.\n");

    goto cleanup;
  }

  wprintf(L"Successfully created Setting object.\n");

  // Get the default email address for the administrator. If set, you 
  // can then use the [Admin Email] macro for any action or report 
  // email address.
  hr = pSettings->get_AdminEmail(&bstr);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->get_AdminEmail failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"AdminEmail: %s\n", bstr);
  SysFreeString(bstr);

  // Determines whether FSRM allows command actions to execute. The default
  // is execute command actions.
  hr = pSettings->get_DisableCommandLine(&boolVal);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->get_DisableCommandLine failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"DisableCommandLine: %s\n", (VARIANT_TRUE == boolVal) ? L"True" : L"False");

  // Determines whether FSRM keeps audit records for file screen IO violations.
  // The default is not to keep audit records.
  hr = pSettings->get_EnableScreeningAudit(&boolVal);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->get_EnableScreeningAudit failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"EnableScreeningAudit: %s\n", (VARIANT_TRUE == boolVal) ? L"True" : L"False");

  // The default address from which reports and email actions are sent.
  // If set, you do not have to set the IFsrmActionEmail::MailFrom property.
  // The default is FSRM@<localdomain>
  hr = pSettings->get_MailFrom(&bstr);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->get_MailFrom failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"MailFrom: %s\n", bstr);
  SysFreeString(bstr);

  // Get the SMTP server. If not set, email is not sent.
  hr = pSettings->get_SmtpServer(&bstr);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->get_SmtpServer failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"SmtpServer: %s\n", bstr);
  SysFreeString(bstr);

  // Each action can specify an interval to wait before executing the action again.
  // The default for each action is 60 minutes.
  wprintf(L"Default interval, in minutes, to wait between executing an action:\n");

  hr = pSettings->GetActionRunLimitInterval(FsrmActionType_EventLog, &interval);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->GetActionRunLimitInterval(FsrmActionType_EventLog) failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"\tEventLog interval: %ld\n", interval);

  hr = pSettings->GetActionRunLimitInterval(FsrmActionType_Email, &interval);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->GetActionRunLimitInterval(FsrmActionType_Email) failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"\tEmail interval: %ld\n", interval);

  hr = pSettings->GetActionRunLimitInterval(FsrmActionType_Command, &interval);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->GetActionRunLimitInterval(FsrmActionType_Command) failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"\tCommand interval: %ld\n", interval);

  hr = pSettings->GetActionRunLimitInterval(FsrmActionType_Report, &interval);
  if (FAILED(hr))
  {
    wprintf(L"pSettings->GetActionRunLimitInterval(FsrmActionType_Report) failed, 0x%x.\n", hr);
    goto cleanup;
  }

  wprintf(L"\tReport interval: %ld\n", interval);

  hr = pSettings->put_SmtpServer(_bstr_t(L"<FQDNOFSMTPSERVER>"));
  if (FAILED(hr))
  {
    wprintf(L"pSettings->put_SmtpServer failed, 0x%x.\n", hr);
    goto cleanup;
  }

cleanup:

  if (pSettings)
    pSettings->Release();

  CoUninitialize();
}


Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2008

Header

Fsrm.h (include FsrmPipeline.h, FsrmQuota.h, FsrmReports.h, FsrmScreen.h, or FsrmTlb.h)

DLL

SrmSvc.dll

CLSID

CLSID_FsrmSetting is defined as f556d708-6d4d-4594-9c61-7dbb0dae2a46 (Defined in FsrmTlb.h)

IID

IID_IFsrmSetting is defined as f411d4fd-14be-4260-8c40-03b7c95e608a

See also

FSRM Interfaces
FsrmSetting

 

 

Show: