Real Geek Forums  

Go Back   Real Geek Forums > Archives > Operating Systems > Windows Vista > Windows Vista Networking & Sharing

Notices

Reply

subject windows Vista Event Logs access through WMI ( Applications and Services Logs)

 

LinkBack Thread Tools Display Modes
Old 04-17-2007, 06:02 PM   #1 (permalink)
Default subject windows Vista Event Logs access through WMI ( Applications and Services Logs)

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();
}

beeess
Guest
 
Posts: n/a
Reply With Quote  
Reply

Tags
None

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT. The time now is 09:56 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright © 2005 - 2007 RealGeek.com. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90