Hi,
I'm writing a c# application which queries the WMI class "Win32_PerfFormattedData_PerfProc_Process" for IDProcess, VirtualBytes and WorkingSet for each running process. When I try to enumerate the ManagementObjects found in the reutrned collection, it is giving me a "Provider failure" (and sometimes "Invalid class") exception. I'm developing on a WinXP machine with .NET framework ver 1.1. The following is the code i'm using to perform the query and enumeration:
ManagementObjectCollection mocPerformances = GetQueryCollection(sQuery);
foreach (ManagementObject mo in mocPerformances) // <- error occurs here
{
....
}
where GetQueryCollection() is implemented as follows:
private ManagementObjectCollection GetQueryCollection(string sQuery)
{
ManagementObjectCollection queryCollection = null;
ObjectQuery oq = new ObjectQuery(sQuery);
ManagementObjectSearcher query = new ManagementObjectSearcher(m_Scope,oq);
queryCollection = query.Get();
return queryCollection;
}
Any ideas on this?
Thanks in advance,
Chris 4 5351
I forgot to paste the WMI query. It's "SELECT IDProcess,VirtualBytes,WorkingSet FROM Win32_PerfFormattedData_PerfProc_Process". Also FYI, my WinXP machine has SP1 installed but not SP2.
Chris
"Christopher Attard" <ch*********@gfi.com> wrote in message news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm writing a c# application which queries the WMI class "Win32_PerfFormattedData_PerfProc_Process" for IDProcess, VirtualBytes and WorkingSet for each running process. When I try to enumerate the ManagementObjects found in the reutrned collection, it is giving me a "Provider failure" (and sometimes "Invalid class") exception. I'm developing on a WinXP machine with .NET framework ver 1.1. The following is the code i'm using to perform the query and enumeration:
ManagementObjectCollection mocPerformances = GetQueryCollection(sQuery);
foreach (ManagementObject mo in mocPerformances) // <- error occurs here
{
...
}
where GetQueryCollection() is implemented as follows:
private ManagementObjectCollection GetQueryCollection(string sQuery)
{
ManagementObjectCollection queryCollection = null;
ObjectQuery oq = new ObjectQuery(sQuery);
ManagementObjectSearcher query = new ManagementObjectSearcher(m_Scope,oq);
queryCollection = query.Get();
return queryCollection;
}
Any ideas on this?
Thanks in advance,
Chris
Do you have to use WMI?
You can probably get this info from System.Diagnostics.Process class. You can do something like:
foreach (Process process in Process.GetProcesses())
{
Console.WriteLine(process.ProcessName + " " + process.WorkingSet + " " + process.VirtualMemorySize + " " + process.Id);
}
--
John Wood
EMail: first name, dot, second name at priorganize.com
"Christopher Attard" <ch*********@gfi.com> wrote in message news:%2******************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm writing a c# application which queries the WMI class "Win32_PerfFormattedData_PerfProc_Process" for IDProcess, VirtualBytes and WorkingSet for each running process. When I try to enumerate the ManagementObjects found in the reutrned collection, it is giving me a "Provider failure" (and sometimes "Invalid class") exception. I'm developing on a WinXP machine with .NET framework ver 1.1. The following is the code i'm using to perform the query and enumeration:
ManagementObjectCollection mocPerformances = GetQueryCollection(sQuery);
foreach (ManagementObject mo in mocPerformances) // <- error occurs here
{
...
}
where GetQueryCollection() is implemented as follows:
private ManagementObjectCollection GetQueryCollection(string sQuery)
{
ManagementObjectCollection queryCollection = null;
ObjectQuery oq = new ObjectQuery(sQuery);
ManagementObjectSearcher query = new ManagementObjectSearcher(m_Scope,oq);
queryCollection = query.Get();
return queryCollection;
}
Any ideas on this?
Thanks in advance,
Chris
Yes I have to use WMI in order to get information about processes running on
remote hosts...System.DIagnostics.Process class works only on localhost
Chris
"John Wood" wrote: Do you have to use WMI?
You can probably get this info from System.Diagnostics.Process class. You can do something like:
foreach (Process process in Process.GetProcesses()) { Console.WriteLine(process.ProcessName + " " + process.WorkingSet + " " + process.VirtualMemorySize + " " + process.Id); }
-- John Wood EMail: first name, dot, second name at priorganize.com
"Christopher Attard" <ch*********@gfi.com> wrote in message news:%2******************@TK2MSFTNGP14.phx.gbl... Hi,
I'm writing a c# application which queries the WMI class "Win32_PerfFormattedData_PerfProc_Process" for IDProcess, VirtualBytes and WorkingSet for each running process. When I try to enumerate the ManagementObjects found in the reutrned collection, it is giving me a "Provider failure" (and sometimes "Invalid class") exception. I'm developing on a WinXP machine with .NET framework ver 1.1. The following is the code i'm using to perform the query and enumeration:
ManagementObjectCollection mocPerformances = GetQueryCollection(sQuery);
foreach (ManagementObject mo in mocPerformances) // <- error occurs here
{
...
} where GetQueryCollection() is implemented as follows:
private ManagementObjectCollection GetQueryCollection(string sQuery)
{
ManagementObjectCollection queryCollection = null;
ObjectQuery oq = new ObjectQuery(sQuery);
ManagementObjectSearcher query = new ManagementObjectSearcher(m_Scope,oq);
queryCollection = query.Get();
return queryCollection;
} Any ideas on this?
Thanks in advance,
Chris
GetProcesses() has an overload that takes a machine name.
"Christopher Attard" <Christopher At****@discussions.microsoft.com> wrote in
message news:D7**********************************@microsof t.com... Yes I have to use WMI in order to get information about processes running
on remote hosts...System.DIagnostics.Process class works only on localhost
Chris
"John Wood" wrote:
Do you have to use WMI?
You can probably get this info from System.Diagnostics.Process class.
You can do something like: foreach (Process process in Process.GetProcesses()) { Console.WriteLine(process.ProcessName + " " + process.WorkingSet + "
" + process.VirtualMemorySize + " " + process.Id); }
-- John Wood EMail: first name, dot, second name at priorganize.com
"Christopher Attard" <ch*********@gfi.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl... Hi,
I'm writing a c# application which queries the WMI class
"Win32_PerfFormattedData_PerfProc_Process" for IDProcess, VirtualBytes and
WorkingSet for each running process. When I try to enumerate the
ManagementObjects found in the reutrned collection, it is giving me a
"Provider failure" (and sometimes "Invalid class") exception. I'm developing
on a WinXP machine with .NET framework ver 1.1. The following is the code
i'm using to perform the query and enumeration: ManagementObjectCollection mocPerformances =
GetQueryCollection(sQuery); foreach (ManagementObject mo in mocPerformances) // <- error occurs
here {
...
} where GetQueryCollection() is implemented as follows:
private ManagementObjectCollection GetQueryCollection(string sQuery)
{
ManagementObjectCollection queryCollection = null;
ObjectQuery oq = new ObjectQuery(sQuery);
ManagementObjectSearcher query = new
ManagementObjectSearcher(m_Scope,oq); queryCollection = query.Get();
return queryCollection;
} Any ideas on this?
Thanks in advance,
Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PW |
last post by:
Hi,
I'm using WinXP-Pro, ASP classic, IIS 5.0.
I regularly get this error, but I know I am the only user accessing the
website at the time of the error.
I looked it up on the MS support...
|
by: Christopher Attard |
last post by:
Hi,
I'm trying to run this function which attempts to get 2 WMI properties from the specific WMI class for a process with a specified IDProcess. It's giving an "Invalid Object Path" exception. The...
|
by: Christopher Attard |
last post by:
Hi, I'm trying to run the following WQL using WMIC from command prompt:
wmic PATH Win32_PerfFormattedData_PerfProc_Process GET IDProcess,VirtualBytes,WorkingSet
and it's returning something...
|
by: AdamM |
last post by:
Hi all,
When I run my VbScript, I get the error: "ActiveX component can't create
object: 'getobject'. Error 800A01AD". Any ideas what I did wrong?
Here's my VBScript:
dim o
set...
|
by: Joergen Bech |
last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running
application on a web server outside of my control, but only the first
time I run it:
1. After a long period of inactivity (or...
|
by: snicks |
last post by:
I'm trying to exec a program external to my ASP.NET app using the following
code. The external app is a VB.NET application.
Dim sPPTOut As String
sPPTOut = MDEPDirStr + sID + ".ppt"
Dim p As...
|
by: Praveen_db2 |
last post by:
Hi All
db2 8.1.3 Windows
I am getting this error in db2diag.log.Please tell why is this error
(-444) always there and how to go about for removing it.
Diag.log output:...
|
by: fniles |
last post by:
In our ASP page, we call XMLHttp to download XML files. When calling our
page using localhost (localhost/myWebSite/myPage.htm), it works, but when
calling using the IP address of the web server...
|
by: MikeJ |
last post by:
In my office, we have workstations with standard Win 2000 images (OS plus
standard apps like Office, etc.) as developers, we then install our
development tools on top of those images. other...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| |