473,396 Members | 1,757 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,396 software developers and data experts.

How to find what user is running a process

The Process class gives a lot of information. One piece it doesn't seem
to give you though is what user a process is running under (unless I'm
missing something here.) Does anyone have an idea on how to retrieve
this information (by the API perhaps?) I've been trying to google for
an answer, but haven't had any luck.

Thanks,
Jeff
Nov 21 '05 #1
1 1679
Jeff,

"Jeff" <js******@woh.rr.com> schrieb:
The Process class gives a lot of information. One piece it doesn't seem
to give you though is what user a process is running under (unless I'm
missing something here.) Does anyone have an idea on how to retrieve this
information (by the API perhaps?)


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 #2

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

Similar topics

1
by: DD | last post by:
I'm not sure that this msg made it out, the first time I sent it, so I am trying again. -- Win XP Home Edition I use System.Diagnostics.Process.GetProcesses()) to get info about the processes...
10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
0
by: dsh | last post by:
I have an ASP.NET web application running on a load-balanced Windows Server 2003 web farm running IIS 6.0, using Active Directory authentication. I'm trying to programmatically create a new...
2
by: Han de Monnink | last post by:
Hi, I am looking for a way to determine het user that is running a certain process, I can retrieve the process ID by calling the GetProcessByName("test") method which will return all processes...
7
by: Dave | last post by:
Is it possible in .NET2.0 to find the user that the current process is running under without going through the whole WMI palaver? I tried looking at ProcessStartInfo.UserName but that was empty - I...
2
by: DBC User | last post by:
I have a program which ccan be called multiple times. Each time, it will open a window and the windows title has unique name. I do not have any control over this program. I want to know is there a...
3
by: SugarDaddy | last post by:
Here's my problem. I have an NT service (really a .NET service) running as local system. I have a .NET form running on the user account. The form and the service communicate via an IPC Channel...
2
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.