473,473 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Create 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.diagnostic.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 1534
Hi,
Add a reference to System.Management to your app. You can get
that info with the wmi.

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("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****************@TK2MSFTNGP10.phx.gbl...
Can you tell who owns a running process in .NET?

I can do the system.diagnostic.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***@bellsouth.net> wrote in message
news:O9**************@TK2MSFTNGP11.phx.gbl...
Hi,
Add a reference to System.Management to your app. You can get
that info with the wmi.

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("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****************@TK2MSFTNGP10.phx.gbl...
Can you tell who owns a running process in .NET?

I can do the system.diagnostic.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
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...
1
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...
6
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...
0
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...
4
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...
24
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...
5
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...
0
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...
4
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. ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.