(fsrm.h) IFsrmSetting 介面
用來設定 FSRM。
若要取得此介面,請呼叫 CoCreateInstanceEx 函 式。 使用 CLSID_FsrmSetting 作為類別識別碼和 __uuidof(IFsrmSetting)
介面識別碼。
繼承
IFsrmSetting介面繼承自IDispatch介面。 IFsrmSetting 也有下列類型的成員:
方法
IFsrmSetting介面具有這些方法。
IFsrmSetting::EmailTest 將電子郵件訊息傳送至指定的電子郵件地址。 |
IFsrmSetting::get_AdminEmail 擷取或設定系統管理員的電子郵件地址。 (取得) |
IFsrmSetting::get_DisableCommandLine 擷取或設定值,判斷 FSRM 是否防止命令列動作執行。 (取得) |
IFsrmSetting::get_EnableScreeningAudit 擷取或設定值,判斷 FSRM 是否保留檔案檢測違規的稽核記錄。 (取得) |
IFsrmSetting::get_MailFrom 擷取或設定傳送電子郵件訊息的預設電子郵件地址。 (取得) |
IFsrmSetting::get_SmtpServer 擷取或設定 FSRM 用來傳送電子郵件的 SMTP 伺服器。 (取得) |
IFsrmSetting::GetActionRunLimitInterval 取得使用全域執行限制間隔的動作必須在動作再次執行之前等候的時間。 |
IFsrmSetting::p ut_AdminEmail 擷取或設定系統管理員的電子郵件地址。 (Put) |
IFsrmSetting::p ut_DisableCommandLine 擷取或設定值,判斷 FSRM 是否防止命令列動作執行。 (Put) |
IFsrmSetting::p ut_EnableScreeningAudit 擷取或設定值,判斷 FSRM 是否保留檔案檢測違規的稽核記錄。 (Put) |
IFsrmSetting::p ut_MailFrom 擷取或設定傳送電子郵件訊息的預設電子郵件地址。 (Put) |
IFsrmSetting::p ut_SmtpServer 擷取或設定 FSRM 用來傳送電子郵件的 SMTP 伺服器。 (Put) |
IFsrmSetting::SetActionRunLimitInterval 設定使用全域執行限制間隔的動作必須等候的時間,才能再次執行動作。 |
備註
若要從腳本建立此物件,請使用程式識別碼 「Fsrm.FsrmSetting」。
範例
下列範例示範如何擷取此介面的屬性。
#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();
}
需求
最低支援的用戶端 | 都不支援 |
最低支援的伺服器 | Windows Server 2008 |
目標平台 | Windows |
標頭 | fsrm.h (包括 FsrmPipeline.h、FsrmQuota.h、FsrmReports.h、FsrmScreen.h、FsrmTlb.h) |