Problem with WMI

G

Guest

Hello,

The application I'm writting, has to ask some informations on Windows 98 computers.
So I installed "Windows Management Instrumentation (WMI) CORE 1.5 (Windows 95/98/NT 4.0)" from Microsoft
ont the target computer and I use System.Managment namespace in my program.
But when I excute my code (which works if I ask informations on a Windows 2000 computer), I have a System.Runtime.InteropServices.COMException in mscorlib.dll.
Additional informations : The RPC Server is not available.

I don't understand why the Windows 98 computer can't reply because I think that I installed the correct program
that install WMI on Windows 98.
Maybe I forgot something on the Windows 98 computer.

Could someone help me ?

Best regards,

François Dehaibe.

ps : here is an example of my code :


ConnectionOptions co = new ConnectionOptions();
co.Username = "";
co.Password = "";
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\192.168.0.160\\root\\cimv2", co);

//Query remote computer across the connection
System.Management.ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine("Name : " + mo["name"].ToString());
Console.WriteLine("Version : " + mo["version"].ToString());
Console.WriteLine("Manufacturer : " + mo["Manufacturer"].ToString());
Console.WriteLine("Computer Name : " +mo["csname"].ToString());
Console.WriteLine("Windows Directory : " +mo["WindowsDirectory"].ToString());
}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_ComputerSystem");
query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
//Console.WriteLine("Manufacturer : " + mo["manufacturer"].ToString());
//Console.WriteLine("Model : " + mo["model"].ToString());
Console.WriteLine(mo["systemtype"].ToString());
Console.WriteLine("Total Physical Memory : " + mo["totalphysicalmemory"].ToString());

}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_processor") ;

query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["caption"].ToString());
}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_bios");
query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["version"].ToString());
}
 
A

Anthony

Does this KB Article shed any light on the problem?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q322363

Apparently there are version problems with WMI on Windows 98.
Anthony


Hello,

The application I'm writting, has to ask some informations on Windows 98 computers.
So I installed "Windows Management Instrumentation (WMI) CORE 1.5 (Windows 95/98/NT 4.0)" from Microsoft
ont the target computer and I use System.Managment namespace in my program.
But when I excute my code (which works if I ask informations on a Windows 2000 computer), I have a System.Runtime.InteropServices.COMException in mscorlib.dll.
Additional informations : The RPC Server is not available.

I don't understand why the Windows 98 computer can't reply because I think that I installed the correct program
that install WMI on Windows 98.
Maybe I forgot something on the Windows 98 computer.

Could someone help me ?

Best regards,

Fran?ois Dehaibe.

ps : here is an example of my code :


ConnectionOptions co = new ConnectionOptions();
co.Username = "";
co.Password = "";
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\192.168.0.160\\root\\cimv2", co);

//Query remote computer across the connection
System.Management.ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine("Name : " + mo["name"].ToString());
Console.WriteLine("Version : " + mo["version"].ToString());
Console.WriteLine("Manufacturer : " + mo["Manufacturer"].ToString());
Console.WriteLine("Computer Name : " +mo["csname"].ToString());
Console.WriteLine("Windows Directory : " +mo["WindowsDirectory"].ToString());
}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_ComputerSystem");
query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
//Console.WriteLine("Manufacturer : " + mo["manufacturer"].ToString());
//Console.WriteLine("Model : " + mo["model"].ToString());
Console.WriteLine(mo["systemtype"].ToString());
Console.WriteLine("Total Physical Memory : " + mo["totalphysicalmemory"].ToString());

}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_processor") ;

query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["caption"].ToString());
}

oq = new System.Management.ObjectQuery("SELECT * FROM Win32_bios");
query1 = new ManagementObjectSearcher(ms,oq) ;
queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
Console.WriteLine(mo["version"].ToString());
}
 
W

Willy Denoyette [MVP]

Dehaibe François said:
Hello,

The application I'm writting, has to ask some informations on Windows 98
computers.
So I installed "Windows Management Instrumentation (WMI) CORE 1.5 (Windows
95/98/NT 4.0)" from Microsoft
ont the target computer and I use System.Managment namespace in my
program.
But when I excute my code (which works if I ask informations on a Windows
2000 computer), I have a System.Runtime.InteropServices.COMException in
mscorlib.dll.
Additional informations : The RPC Server is not available.

I don't understand why the Windows 98 computer can't reply because I think
that I installed the correct program
that install WMI on Windows 98.
Maybe I forgot something on the Windows 98 computer.


Make sure you did install/configure DCOM98 on Windows98.

http://www.microsoft.com/com/dcom/dcom98/download.asp



Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top