473,662 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting to WMI on a Remote Computer using C#

13 New Member
Hi,
I am Connecting ti remote computer using C# WMI through the following code.But i t gives Some error "INVALID PARAMETERS" plse suggest me any modification in the code.
Expand|Select|Wrap|Line Numbers
  1. try
  2.             {
  3.                 ConnectionOptions connection = new ConnectionOptions();
  4.                 connection.Username = userNameBox.Text;
  5.                 connection.Password = passwordBox.Text;
  6.                 connection.Authority = "ntlmdomain:DOMAIN";
  7.  
  8.                 ManagementScope scope = new ManagementScope(
  9.                     "\\\\FullComputerName\\root\\CIMV2", connection);
  10.                 scope.Connect();
  11.  
  12.                 ObjectQuery query= new ObjectQuery(
  13.                     "SELECT * FROM Win32_Service"); 
  14.  
  15.                 ManagementObjectSearcher searcher = 
  16.                     new ManagementObjectSearcher(scope, query);
  17.  
  18.                 foreach (ManagementObject queryObj in searcher.Get())
  19.                 {
  20.                     Console.WriteLine("-----------------------------------");
  21.                     Console.WriteLine("Win32_Service instance");
  22.                     Console.WriteLine("-----------------------------------");
  23.                     Console.WriteLine("Caption: {0}", queryObj["Caption"]);
  24.                     Console.WriteLine("Description: {0}", queryObj["Description"]);
  25.                     Console.WriteLine("Name: {0}", queryObj["Name"]);
  26.                     Console.WriteLine("PathName: {0}", queryObj["PathName"]);
  27.                     Console.WriteLine("State: {0}", queryObj["State"]);
  28.                     Console.WriteLine("Status: {0}", queryObj["Status"]);
  29.                 }
  30.                 Close();
  31.             }
  32.             catch(ManagementException err)
  33.             {
  34.                 MessageBox.Show("An error occured while querying for WMI data: "
  35.                     + err.Message);
  36.             }
Thanks
Prasad
Dec 8 '08 #1
1 23951
PRR
750 Recognized Expert Contributor
Connect To remote PC
There are certain issues regarding WMI connection to remote Pcs ...
Issues
Also a firewall may block remote WMI calls...
Also check this thread wmi
Dec 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3245
by: stabbert | last post by:
We are running DB2 UDB 8.1.6 in a partitioned environment where we have 8 physical nodes. We have a process that remotely connects to each individual node and loads some data. By setting the DB2NODE variable to a different value then the coordinator node is the only way I am aware for a remote application to do this so I am making the assumption that is how this application connects. What I am more interested in is that after logging...
1
2602
by: Jim Bayers | last post by:
Our network nazi doesn't want us running a webserver on the server that has a connection to the campus database so we created a remote object that runs as a windows service. The windows service runs on the server with a connection to the campus database and we make calls to it. My question is, how best to connect to this object via asp.net, in an aspx page?. The example I had used a console ap to connect and that works, but we want to...
3
1450
by: Frank Schumacher | last post by:
Hi NG, I try to connect to a remote MS-SQL-Server 2000 from an ASP.NET application. Here's how I do it: private void ConnectToDatabase(string host, string dataBaseName, string userID, string password) { string connectionString;
9
2696
by: RvGrah | last post by:
After much hair-pulling, I've finally found the answer to a problem that many are fighting with, difficulty connecting from Sql 2005 Server Management or VS2005 to a remote Sql Server running Sql 2000. In my case the server I couldn't reach was across a vpn connection, behind ISA server 2000, (which had port 1433 open). The answer was in this post:...
0
3917
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2 development client. Bur Its gives me following error message. I searched lots of things on net and tried on remote server but i didnt got suceess. Can any one tell me how to set TCP\IP connection protocol on server for particular instance. Becuase I think
0
1516
by: Zebadunc | last post by:
I have a vb.net form that lists the shared printers in from a remote computer in a checklist box giving the shareName as the value for the user to select. I want to use the print server name and the share name to map this printer connection to a remote computer. I have seen plenty of examples of the addprinterconnection function and addwindowsprinterconnection method but any of these only work when mapping the printer to the local...
1
1647
by: SayamiSuchi | last post by:
Hi.. I have been assigned to make a database in some remote machine.The machine has MSSQL 2005.I need to connect to that remote machine's sql server via my pc using my SQL Management express.I do have that computer's IP address(say,123.456.789.000),and the username and password.But when i try to connect to the server ,I get the following error: Cannot connect to 123.456.789.000\sqlexpress An error has occured while establishing a...
2
1868
by: SayamiSuchi | last post by:
-------------------------------------------------------------------------------- Hi, I have made one web application using Asp dot net 2005 and sql server 2005.The sql server i am connecting is the remote sql server..When i run my application in my computer and in LAN, it worked without any error..I run it after publishing it and even making virtual directory..It worked fairly...But when i upload the application to the remote machine.e i...
3
5736
by: Me LK | last post by:
I did a search but could not find an aswer that worked so here it goes. I just did an upgrade from 2003 to vs 2005 express. I am using a remote sql server 2000. I specifically upgrade to make use of the login control. Everything upgraded fine and the site is working on my local machine. It seems that my site is trying to connect to a local database. I need it to attach to a remote database. I added a connection string to
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.