M
msnews.microsoft.com
Hi,
When invoking the BackupEventlog method the retuen values as documnated in
the wmi sdk are as listed bellow but I receive a return code of 3 which is
undocumanted:
Return code Description
0 Success
8 Privilege missing
21 Invalid parameter
183 Archive file name already exists
private void wmiEventLog_System()
{
SelectQuery strQuery = new SelectQuery("SELECT * FROM Win32_NTEventLogFile
where LogFileName='System'");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(ms,
strQuery);
ManagementObjectCollection oCollection = null;
oCollection = oSearcher.Get();
UInt32 rc = 0;
foreach(ManagementObject item in oCollection)
{
try
{
object[] methodArgs = new object[] {path + file + "\\EventLog_System.evt"};
rc = (UInt32)((ManagementObject)item).InvokeMethod("BackupEventLog",
methodArgs);
}
catch (Exception exp)
//catch (ManagementException exp)
{
Debugger.Log(10, "bug", exp.Message);
log.WriteLine(Global.TS() + Global.LogName(name) + "wmiEventLog_System: " +
exp.Message);
log.Flush();
}
}
}
When invoking the BackupEventlog method the retuen values as documnated in
the wmi sdk are as listed bellow but I receive a return code of 3 which is
undocumanted:
Return code Description
0 Success
8 Privilege missing
21 Invalid parameter
183 Archive file name already exists
private void wmiEventLog_System()
{
SelectQuery strQuery = new SelectQuery("SELECT * FROM Win32_NTEventLogFile
where LogFileName='System'");
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(ms,
strQuery);
ManagementObjectCollection oCollection = null;
oCollection = oSearcher.Get();
UInt32 rc = 0;
foreach(ManagementObject item in oCollection)
{
try
{
object[] methodArgs = new object[] {path + file + "\\EventLog_System.evt"};
rc = (UInt32)((ManagementObject)item).InvokeMethod("BackupEventLog",
methodArgs);
}
catch (Exception exp)
//catch (ManagementException exp)
{
Debugger.Log(10, "bug", exp.Message);
log.WriteLine(Global.TS() + Global.LogName(name) + "wmiEventLog_System: " +
exp.Message);
log.Flush();
}
}
}