I have a C# app application working to some extent. What i need to do is to continue execution if a computer (given an IP Address) is running an application (TEKBSS.exe). How can i do that? Can someone help me?
You can do this through WMI. You'll need appropriate credentials to access the remote machine.
The System.Management namespace includes features for using WMI from C#.
Here you go:
// Don't forget...
// using System.Management; <-- Need to add a reference to System.Management, too.
ManagementScope scope = new ManagementScope(@"\\192.168.1.73\root\cimv2");
string query = "SELECT * FROM Win32_Process WHERE Name='TEKBSS.exe'";
var searcher = new ManagementObjectSearcher(query);
searcher.Scope = scope;
bool isRunning = searcher.Get().Count > 0;
The scope tells WMI what machine to execute the query on, so don't forget to change the IP address accordingly.
The ManagementObjectSearcher will then query the machine for a list of all processes with the name TEKBSS.exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With