您可以查詢 event_historical 資料庫以顯示錯誤事件、警告事件和特定的最近事件。

備註: 請將下列範例中的 dbo.VE_ 首碼取代為您事件資料庫適用的首碼。

列出錯誤事件

下列查詢會顯示 event_historical 資料表中的所有錯誤事件。

CREATE VIEW error_events AS
    (
    SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.ModuleAndEventText
        FROM dbo.VE_event_historical AS ev
        WHERE ev.Severity = ‘ERROR’
    );

列出警告事件

下列查詢會顯示 event_historical 資料表中的所有警告事件。

CREATE VIEW warning_events AS
    (
    SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.ModuleAndEventText
        FROM dbo.VE_event_historical AS ev
        WHERE ev.Severity = ‘WARNING’
    );

列出最近事件

下列查詢會列出與網域 MYDOM 中使用者 fred 相關聯的所有最近事件。

CREATE VIEW user_fred_events AS
    (
    SELECT ev.EventID, ev.Time, ev.Module, ev.EventType, ev.Severity, ev.Acknowledged
        FROM dbo.VE_event_historical AS ev,
            dbo.VE_event_data_historical AS ed
        WHERE ev.EventID = ed.EventID AND ed.Name = 'UserDisplayName' AND ed.StrValue =
            ‘MYDOM\fred’
    );

下列查詢會列出機器上代理程式關閉的所有最近事件。

CREATE VIEW agent_shutdown_events AS
    (
    SELECT ev.EventID, ev.Time, ed.StrValue
        FROM dbo.VE_event_historical AS ev,
            dbo.VE_event_data_historical AS ed
        WHERE ev.EventID = ed.EventID AND ev.EventType = ‘AGENT_SHUTDOWN’ AND
            ed.Name = ‘MachineName’
    );

下列查詢會列出桌面平台因桌面平台集區是空的而無法啟動的所有最近事件。

CREATE VIEW desktop_launch_failure_events AS
    (
    SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue
        FROM dbo.VE_event_historical AS ev,
            dbo.VE_event_data_historical AS ed1,
            dbo.VE_event_data_historical AS ed2
        WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND
            ev.EventType = ‘BROKER_POOL_EMPTY’ AND
            ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘DesktopId’
    );

下列查詢會列出管理員已移除桌面平台集區的所有最近事件。

CREATE VIEW desktop_pool_removed_events AS
    (
    SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue
        FROM dbo.VE_event_historical AS ev,
            dbo.VE_event_data_historical AS ed1,
            dbo.VE_event_data_historical AS ed2
        WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND
            ev.EventType = ‘ADMIN_DESKTOP_REMOVED’ AND
            ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘DesktopId’
);

下列查詢會列出管理員已新增 ThinApp 存放庫的所有最近事件。

CREATE VIEW thinapp_repository_added_events AS
    (
    SELECT ev.EventID, ev.Time, ed1.StrValue, ed2.StrValue, ed3.StrValue
        FROM dbo.VE_event_historical AS ev,
            dbo.VE_event_data_historical AS ed1,
            dbo.VE_event_data_historical AS ed2,
            dbo.VE_event_data_historical AS ed3
        WHERE ev.EventID = ed1.EventID AND ev.EventID = ed2.EventID AND ev.EventID = ed3.EventID
        AND
            ev.EventType = ‘ADMIN_THINAPP_REPO_ADDED’ AND
            ed1.Name = ‘UserDisplayName’ AND ed2.Name = ‘ThinAppRepositoryName’ AND
            ed3.Name = ‘ThinAppRepositoryPath’
);