HighTechTalks DotNet Forums  

WMI + DCOM + VPN ...Slow

Dotnet Framework (WMI) microsoft.public.dotnet.framework.wmi


Discuss WMI + DCOM + VPN ...Slow in the Dotnet Framework (WMI) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
barneymc
 
Posts: n/a

Default WMI + DCOM + VPN ...Slow - 08-29-2007 , 05:52 AM






Any help with this topic woud be appreciated greatly. I am using WMI
over VPN.
The authentication takes > 30 seconds. Way toooo slow. [Crunch
below]. Inside the corporate LAN yesterday this connection was < 2
seconds. Included full code below. Is the oConn.Impersonation =
ImpersonationLevel.Impersonate correct ?

All suggestions welcome.
Many thanks.


sWMIQuery= Select * from Win32_NTLogEvent Where LogFile='Application'
and TimeGenerated >='20070813170102.000000+060'";


public ArrayList GetEvents(string sWMIQuery, string
sMachineName,string sUserName,string sPassword)
{
try
{


ManagementObjectSearcher searcher = null;
string sNameSpace = "root\\cimv2";
ArrayList foundEntries = new ArrayList();


System.Management.ManagementScope oMs = new
System.Management.ManagementScope("\\\\" + sMachineName + "\\" +
sNameSpace);


ConnectionOptions oConn = new
ConnectionOptions();
oConn.Username = sUserName;
oConn.Password = sPassword;
oConn.Impersonation =
ImpersonationLevel.Impersonate;
oMs.Connect(); ///Crunch
searcher = new
ManagementObjectSearcher(sWMIQuery);
searcher.Get();
searcher.Scope = oMs;


int counter = 0;


//returns the records
foreach (ManagementObject Event in
searcher.Get())
{
counter = counter + 1;
//Some of the Messages are NULL when viewed
thru WMI CIM Studio - must check for these
if (Event.Properties["Message"].Value !=
null)


{
WMIEvent wmiEvent = new WMIEvent(

Event.Properties["Message"].Value.ToString(),

Event.Properties["Type"].Value.ToString(),
Event.Properties["LogFile"].Value.ToString());


foundEntries.Add(wmiEvent);
}
}


return foundEntries;
}


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.