473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WMI remote connection slow - help.

Hi,

I have 7 computers and 5 controllers(no OS) connected to Domain controller.
when I used WMI to query for registry, it take a long time (about 60
minutes) to return the result. if it a controller then there is no WMI and
return a NULL ManagementClass. Does anyone know there is another way to make
it run faster?

protected static ManagementClass ConnectToConfigProv(string host, string
managementClass)
{
ManagementClass Config;
try
{
ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
string sPath = "\\\\" + host + "\\root\\cimv2";
ManagementScope scope = new ManagementScope(sPath, options);
scope.Connect();
Config = new ManagementClass(
scope,
new ManagementPath(managementClass),
null);
}
catch
{
sErr = "WMI connection failed";
return Config=null;
//throw (new Exception(sErr));
}

return Config;
}

public string RemoteRegistryReadValue(string sServer)
{
ManagementClass ManageConfig;
string sValue = null;
string sErrMsg = null;
string mgmtPath = "Win32_OperatingSystem";

ManageConfig= ConnectToConfigProv(sServer, mgmtPath);
if (ManageConfig== null)
{
sErrMsg = "WMI connection to \"Win32_OperatingSystem\" of
computer " + sServer + " failed";
//throw (new Exception(sErrMsg));
}
else
{
sValue = "There is no WMI, must be controller";
}

return sValue;

}
thanks
Sep 19 '06 #1
2 5574

"ttan" <tt**@discussions.microsoft.comwrote in message
news:98**********************************@microsof t.com...
| Hi,
|
| I have 7 computers and 5 controllers(no OS) connected to Domain
controller.
| when I used WMI to query for registry, it take a long time (about 60
| minutes) to return the result. if it a controller then there is no WMI and
| return a NULL ManagementClass. Does anyone know there is another way to
make
| it run faster?
|
| protected static ManagementClass ConnectToConfigProv(string host, string
| managementClass)
| {
| ManagementClass Config;
| try
| {
| ConnectionOptions options = new ConnectionOptions();
| options.Impersonation = ImpersonationLevel.Impersonate;
| string sPath = "\\\\" + host + "\\root\\cimv2";
| ManagementScope scope = new ManagementScope(sPath,
options);
| scope.Connect();
| Config = new ManagementClass(
| scope,
| new ManagementPath(managementClass),
| null);
| }
| catch
| {
| sErr = "WMI connection failed";
| return Config=null;
| //throw (new Exception(sErr));
| }
|
| return Config;
| }
|
| public string RemoteRegistryReadValue(string sServer)
| {
| ManagementClass ManageConfig;
| string sValue = null;
| string sErrMsg = null;
| string mgmtPath = "Win32_OperatingSystem";
|
| ManageConfig= ConnectToConfigProv(sServer, mgmtPath);
| if (ManageConfig== null)
| {
| sErrMsg = "WMI connection to \"Win32_OperatingSystem\" of
| computer " + sServer + " failed";
| //throw (new Exception(sErrMsg));
| }
| else
| {
| sValue = "There is no WMI, must be controller";
| }
|
| return sValue;
|
| }
|
|
| thanks

What are "controllers (no OS)" and are you sure about the 60 minutes? The
connection time-out is much lower. What happens if you try using Wbemtest or
WMIStudio (from the WMI tools kit).
Willy.
Sep 19 '06 #2

it's a third party controller(alarm, signal) and it does have an IPaddress.
From the domain controller I have to filter out the third party controller
and set the service start/stop on a real computer.
My question is: if there is no WMI on the third party controller, where is
the code failed?
failed here - ManagementScope scope = new ManagementScope(sPath, options);
OR
- scope.connect();
does it return anything?
"Willy Denoyette [MVP]" wrote:
>
"ttan" <tt**@discussions.microsoft.comwrote in message
news:98**********************************@microsof t.com...
| Hi,
|
| I have 7 computers and 5 controllers(no OS) connected to Domain
controller.
| when I used WMI to query for registry, it take a long time (about 60
| minutes) to return the result. if it a controller then there is no WMI and
| return a NULL ManagementClass. Does anyone know there is another way to
make
| it run faster?
|
| protected static ManagementClass ConnectToConfigProv(string host, string
| managementClass)
| {
| ManagementClass Config;
| try
| {
| ConnectionOptions options = new ConnectionOptions();
| options.Impersonation = ImpersonationLevel.Impersonate;
| string sPath = "\\\\" + host + "\\root\\cimv2";
| ManagementScope scope = new ManagementScope(sPath,
options);
| scope.Connect();
| Config = new ManagementClass(
| scope,
| new ManagementPath(managementClass),
| null);
| }
| catch
| {
| sErr = "WMI connection failed";
| return Config=null;
| //throw (new Exception(sErr));
| }
|
| return Config;
| }
|
| public string RemoteRegistryReadValue(string sServer)
| {
| ManagementClass ManageConfig;
| string sValue = null;
| string sErrMsg = null;
| string mgmtPath = "Win32_OperatingSystem";
|
| ManageConfig= ConnectToConfigProv(sServer, mgmtPath);
| if (ManageConfig== null)
| {
| sErrMsg = "WMI connection to \"Win32_OperatingSystem\" of
| computer " + sServer + " failed";
| //throw (new Exception(sErrMsg));
| }
| else
| {
| sValue = "There is no WMI, must be controller";
| }
|
| return sValue;
|
| }
|
|
| thanks

What are "controllers (no OS)" and are you sure about the 60 minutes? The
connection time-out is much lower. What happens if you try using Wbemtest or
WMIStudio (from the WMI tools kit).
Willy.
Sep 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Mike MacSween | last post by:
Sorry if this is a bit off topic, but I can't seem to find a 'remote control' newsgroup on my news server. And anyway I know Tony has some experience of this. The app is split FE/BE. I'd like...
3
by: gharmel | last post by:
I'm trying to get some clues on why I get (much) slower responses from my PHP applications when dealing with a remote sql server as opposed to a local sql server. Here's my situation: Server...
4
by: JIM.H. | last post by:
Hello, My database stays in a remote site and I have access it through VPN. I would like connect my current Windows based Asp.Net application with this database. What are my options? Can I...
18
by: Asif | last post by:
Hi all, I am working on portal which is using MS Access 2003 database. The problem that I am facing is that once I received data from vendors I have to upload whole Access Database file to...
5
by: Mitya Mitriev | last post by:
Hi I created ASP.NET 2.0 web application that uses SQL Server 2000 database and it works perfectly when website and Sql server were on local machine. Then I installed application on production...
4
by: Amit | last post by:
I cannot run aspnet_regsql.exe on a remote machine. The remote machine is running MSSQL 2000 and is behind my local network. Its basically a sandbox machine. I specify my remote machine's...
4
by: Noy B | last post by:
Hi, I have developed a small application that is using a MSAccess DB. the problem is that it was developed on a machine where the application and the DB are both located. now it needs to be...
8
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is...
4
by: chris | last post by:
Hi guys I have a Frontend and Backend DB that works well on my LAN. I use a INI file Path, to access a mapped network connection back to the Backend Data file. Path=F:\Server\Data.mdb I...
0
by: roger1948 | last post by:
I have a MySQL database on a remote server. when i connect to it using Heidisql it open pretty instantly but.. using an ADO connection string server=xxx.xxx.218.237;db=xxxxx2;driver={MySQL...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.