I have used EvtOpenSession
API to create a session to a remote machine's eventlog, then used the session handle to call EvtExportLog
API. I need the eventlog file in the host PC(where I am running this application), but this API is dumping the evenlog into the remote machine itself. What should I do to get the eventlog in host PC?
I have tried with a shared path in host PC as well(instead of _T("C:\Test\EventLogApplication.evt") I used _T("\\ComputerName\Events\EventLogApplication.evt"). In this case I am getting an access violation error.
here is the code snippet i used
......
hRemote = EvtOpenSession(EvtRpcLogin, &Credentials, 0, 0);
if (hRemote)
{
if (!EvtExportLog(hRemote, _T("Application"), NULL,_T("C:\\Test\\EventLogApplication.evt"), EvtExportLogChannelPath))
{
std::cout << "Error-Code : " << GetLastError() << std::endl;
}
}
......