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());
}
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());
}