473,320 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

get the username associated with a process

Hi,

I am trying to get the name of the user which stared a process... similar to
the user name column in the process list in task manager. I have looked
through the Process members but am at a loss to find what I require!

Any help would be greatly appreciated.
--
If at first you don't succeed... Hide the evidence that you tried!
Nov 21 '05 #1
2 6500
In article <4E**********************************@microsoft.co m>,
Di*************@discussions.microsoft.com says...
Hi,

I am trying to get the name of the user which stared a process... similar to
the user name column in the process list in task manager. I have looked
through the Process members but am at a loss to find what I require!

Any help would be greatly appreciated.


You'll have to do some PInvoke with the Win32 API. Here's a C# example
that shows the calls and process:

http://tinyurl.com/dtvva

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 21 '05 #2
"Director - Minvent" <Di*************@discussions.microsoft.com> schrieb:
I am trying to get the name of the user which stared a process... similar
to
the user name column in the process list in task manager. I have looked
through the Process members but am at a loss to find what I require!


You can utilize the 'Win32_Process' class and its 'GetOwner' method to
determine domain and user the process is belonging to. The documentation on
'Win32_Process' contains a VBScript sample on how to do that:

Platform SDK: Windows Management Instrumentation -- 'Win32_Process'
<URL:http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_process.asp>

Samples for VB.NET and C# can be found here:

<URL:http://www.google.to/groups?q=dotnet+Win32_Process+GetOwner+-herfried>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

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...
4
by: 1qa2ws | last post by:
Hi, I need to get the windows current logged username and domain. Is it any possibility? 1qa2ws
3
by: William Stacey [MVP] | last post by:
Is this a bug in fx2? I expect they did not carry forward all the StartInfo properties to api used with Username/Password. When you remove UserName/password, the window does not show as expected....
5
by: Prisy | last post by:
In asp.net(C#) we can get the Process Name of a process using the following code: System.Diagnostics.Process item; item.ProcessName.ToString(); Is there a way to get the User Name of a...
2
by: Gos | last post by:
Hi, I have a program that needs to open a list of attachments displayed on a ListView. I have used Process.Start method to open the files using their associated program. This works correctly if...
8
by: Philip Wagenaar | last post by:
I need to send printjobs to a printqueue under diffrent usernames. The printsoftware on the queue is not very 'secure' so I can create a user on 1 system and send a printjob under it's name to the...
11
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any...
0
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
8
by: yaaara | last post by:
Hi Guys !! Is there any way we can extract the Windows ID & Username associated with it using VBA? For example, if my Windows ID is "kumar1" and I have a Username "yaaara" associated with it,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.