![]() |
| |||||||
| Notices |
![]() |
| LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Hi, I am trying to access Vista Event Logs say Applications and Services Logs. For example if I wanted to query DFS replication log (this log is not present in XP and 2003) what would my query be. Query to be initiated by box running Win2003 and .NET 2.0 (not 3.0) Please advise whether I can query vista from box running .NEt 2.0 and what should my WQL query look like. Working code perfectly for 2003 and XP is below. PS: Even if you don't know the answer feel free to point out a resource or website that might be helpful Regards, beeess bool res = true; ManagementClass mc = null; m_mngScope = null; try { if (PropertyNames == null)//No specific properties given, return all of them { mc = new ManagementClass(wmiClass); PropertyDataCollection props = mc.Properties; PropertyNames = new string[props.Count]; int idx = 0; foreach (PropertyData pd in props) { PropertyNames[idx++] = pd.Name; } } string strQuery = "SELECT * from " + wmiClass; if (queryCondition != null) strQuery = strQuery + " Where " + queryCondition; objQuery = new ObjectQuery(strQuery); m_mngScope = new ManagementScope(@"\\" + connectOptions.IP + "\ \root\ \cimv2", connectOptions); } catch (Exception ex) { Trace.WriteLine("WMI exception at :" + DateTime.Now.ToString()); IPrincipal threadPrincipal = Thread.CurrentPrincipal; Trace.WriteLine(ex.StackTrace); Trace.WriteLine("Identity Name:" + threadPrincipal.Identity.Name); Trace.WriteLine("Authentication: " + threadPrincipal.Identity.AuthenticationType); Trace.WriteLine("Authenticated: " + threadPrincipal.Identity.IsAuthenticated.ToString( )); } if (mc != null) mc.Dispose(); return res; ... ... ... ArrayList moCollect = new ArrayList(); if (!PrepareForQuery(null)) return moCollect; ManagementObjectSearcher oSearcher = null; try { oSearcher = new ManagementObjectSearcher(m_mngScope, objQuery); if (m_Timeout > 0)//execute semisynchronously { AsyncSearcherGet asg = new AsyncSearcherGet(oSearcher, m_Timeout); bool success = asg.Execute(moCollect); } else { ManagementObjectCollection moCollection = null; try { moCollection = oSearcher.Get(); foreach (ManagementObject mo in moCollection) { moCollect.Add(mo); } } catch { } if (moCollection != null) moCollection.Dispose(); } } catch { } finally { if (oSearcher != null) oSearcher.Dispose(); } | Guest
Posts: n/a
|
|
![]() |
| Tags |
| None |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My XP now logs me out when I log in ?? | David Jones | Windows Vista Install & Setup | 0 | 06-12-2006 02:38 AM |
| MSN Logs Help | Bruce Lawrence | Windows XP Configuration & Management | 3 | 02-04-2005 04:03 AM |
| Messenger Logs me in, then Logs me out immediately | Mona Syed | Windows XP Messenger | 0 | 08-13-2003 08:29 PM |
| Event Viewer Security Logs: Intruder Detected | ? T-Rex ? | Windows XP Security & Administration | 2 | 07-06-2003 04:31 AM |
| Security Event Logs in (Comp.Man.\Sys.Tools) | Eric Fitzgerald [MSFT] | Windows XP Security & Administration | 0 | 07-02-2003 10:28 PM |