Remote Connection before WMI Query takes too long

darendenet

New member
Joined
Dec 26, 2021
Messages
2
Programming Experience
1-3
I am making WMI queries to remote computers that are in our production network. The first connection with ManegementScope takes realy long. (8-10 seconds) If the first connection is done the next connection is then much faster. How can i speed up this connection time. That's the code i am using:

C#:
public void WMI_Connect()
{
System.Management.ConnectionOptions options = new System.Management.ConnectionOptions();
options.Username = "user";
options.Password = "password";
WMI_path = "\\\\" + MAE_Selection.MAE_IP_PCU + "\\root\\cimv2";
ManagementScope scope = new ManagementScope(WMI_path, options);
try
{
// Start WMIconnect
scope.Connect();
// WMI Connection done ( takes 8-10 seconds !!!)
// The method in that i am doing the WMI queries. The WMI query method takes less then 1 second
Read_General_Data_WMI();
}
catch (Exception ex)
{
using (StreamWriter sw = File.AppendText((Start.error_path)))
{
sw.WriteLine(ex);
WMI_Con_State = "Connection_failed";
}
}
}
 
Last edited by a moderator:
Sounds more like a WMI question and C# just happened to be the language used to access WMI.
 
Are you using Active Directory? Are the production machines in the same forest as your client application? In my company, accessing anything in the other forests always took a long initial connect time was in the 30-45 second range. We tried complaining to the AD admins and they said is was normal expected behavior. It was unusual though because when they were doing a screenshare they were not getting the delays we were getting.
 
Are you using Active Directory? Are the production machines in the same forest as your client application? In my company, accessing anything in the other forests always took a long initial connect time was in the 30-45 second range. We tried complaining to the AD admins and they said is was normal expected behavior. It was unusual though because when they were doing a screenshare they were not getting the delays we were getting.
The Client that queries the WMI information is in the server zone, and the machines in the production network zone. But normaly when i try to map anetwork drive from the same machine it takes not so long
 
SMB protocol is not the same as the WMI protocol.
 
Back
Top Bottom