473,574 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Who owns a running process?

Can you tell who owns a running process in .NET?

I can do the system.diagnost ic.process object and see if an application of
the same name is running but I need to tell if the process is running by a
current user or by another user.

Anyone know how to do this?

Thanks

Nov 20 '05 #1
2 1538
Hi,
Add a reference to System.Manageme nt to your app. You can get
that info with the wmi.

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_Process")

moReturn = moSearch.Get

For Each mo In moReturn

Dim arOwner(2)

mo.InvokeMethod ("GetOwner", arOwner)

Debug.WriteLine (String.Format( "{0} Owner {1} Domain {2}", mo("Name"),
arOwner(0), arOwner(1)))

Next

Ken

-------------------

"Scott Meddows" <sc************ ******@tsged-removeme.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Can you tell who owns a running process in .NET?

I can do the system.diagnost ic.process object and see if an application of
the same name is running but I need to tell if the process is running by a
current user or by another user.

Anyone know how to do this?

Thanks

Nov 20 '05 #2
What are the other methods I can call from this?

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:O9******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
Add a reference to System.Manageme nt to your app. You can get
that info with the wmi.

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

moSearch = New Management.Mana gementObjectSea rcher("Select * from
Win32_Process")

moReturn = moSearch.Get

For Each mo In moReturn

Dim arOwner(2)

mo.InvokeMethod ("GetOwner", arOwner)

Debug.WriteLine (String.Format( "{0} Owner {1} Domain {2}", mo("Name"),
arOwner(0), arOwner(1)))

Next

Ken

-------------------

"Scott Meddows" <sc************ ******@tsged-removeme.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Can you tell who owns a running process in .NET?

I can do the system.diagnost ic.process object and see if an application of the same name is running but I need to tell if the process is running by a current user or by another user.

Anyone know how to do this?

Thanks


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2580
by: wesley | last post by:
Hello, How do I pass object to the current running process? For example my assembly is called program.exe. Once program.exe is running sometime I want to call it again ie: program.exe /m do_stuff Now how do I pass that "do_stuff" to the currently running instance?
1
2036
by: Marc | last post by:
I want to write a C#/ASP.NET application where a user can go to a web page, start running a job, close their browser, and then come back later and see the results. The purpose for this application is for a user to be able to use a page on our intranet to start running a time-consuming reporting and analysis job. I'm not sure how to start a process...
6
21658
by: Moses M | last post by:
I posted this a short while ago , but I don't think I explained the problem clearly. Task Manager lists processes running on a local system, including a "user name" associated with each process (e.g. SYSTEM). My application needs to check if a particular process is running, and if so get the associated "owner". I am really trying to...
0
2169
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a command button in the application. So the code goes something like this: psiBat = New ProcessStartInfo(arrRun.Item(0)(1)) psiBat.WindowStyle =...
4
821
by: sneffe | last post by:
Hi, im writing a program to keep track of which programs is currently running. I would like to have the caption of running programs displayed in a textbox on my form. I cant seem to find an easy way to do this in vb.net. Does anybody have a piece of code that can help me? Thanks
24
4421
by: Sathyaish | last post by:
Who owns the language C#? I'm not talking about the compiler, but about the language? Who owns it - Microsoft or the ECMA? I see there are two specifications to each version: 1. One that comes out from Microsoft; and 2. Another that is a follow up from ECMA TC39 (ECMA-334) that is revised after every release from Microsoft. What's the...
5
6569
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same (System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to solve my problem but could not. Background : My app uses a WebBrowser control to display to the user the contents...
0
1107
by: Mark Rae | last post by:
Hi, For years I've been using the clwhois.exe app to check whether domains are available or not and, if not, who owns them: http://www.whoisview.com/products/clwhois/ Because this is a command line utility, it requires the System.Diagnostics.Process class. It works well enough (code is below), but I was wondering if anyone has a more...
4
2844
by: commander_coder | last post by:
Hello, I write a lot of CGI scripts, in Python of course. Now I need to convert some to long-running processes. I'm having trouble finding resources about the best practices to do that. I've found a lot of email discussions that say something like, "You need to educate yourself about the differences when you have long- running...
0
7815
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...
0
8077
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7828
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...
1
5634
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...
0
5316
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...
0
3755
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3765
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1076
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...

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.