A Windows Vista forum. Vista Banter

Welcome to Vista Banter.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to ask questions and reply to others posts, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Go Back   Home » Vista Banter forum » Microsoft Windows Vista » Networking with Windows Vista
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Networking with Windows Vista Networking issues and questions with Windows Vista. (microsoft.public.windows.vista.networking_sharing)

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



 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old April 17th 07, 06:02 PM posted to microsoft.public.windows.vista.networking_sharing
beeess
external usenet poster
 
Posts: 2
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();
}

 




Thread Tools
Display Modes

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

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



All times are GMT. The time now is 05:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.Search Engine Optimization by vBSEO 3.0.0 RC6
Copyright ©2004-2012 Vista Banter.
The comments are property of their posters.