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

process owner

i am using the following code and it works great in a terminal service
environment until i log in as a non-admin.
if i log in as an admin it works fine but otherwise i get a null returned
from the "getowner" call. Any help is as always greatly appreciated.

string query = "Select * From Win32_Process Where ProcessID = " +
iProcessID;
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection processList = searcher.Get();
foreach (ManagementObject obj in processList)
{
string[] argList = new string[] { string.Empty };
int returnVal = Convert.ToInt32(obj.InvokeMethod("GetOwner", argList));
if (returnVal == 0)
return argList[0];
}
Jul 30 '07 #1
0 1344

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

Similar topics

1
by: ravi | last post by:
Hello everyone, Could any one tell me how to find the username(owner name) from a process handle or a process ID. ? thank you for your help Ravi
0
by: Durval Mateus | last post by:
Hello, I need to know the owner of a process, but the process class does not have that info. How can i retrieve the owner info? thanks in advance, Durval Mateus
0
by: DD | last post by:
Win XP Home Edition I use System.Diagnostics.Process.GetProcesses()) to get info about the processes running. I don't see any members of class' Process' which allows me to get the name of the...
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...
4
by: news.microsoft.com | last post by:
I need to find a way to run an external exe (using the process class I assume) and hide. When the process is closed I want my application to reappear. For example, press a button on form1, run...
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...
1
by: Tim B | last post by:
Hi I am writing a program for a terminalserver. But the program should startet only once so i write a methode which returns if the process is running: .... Process processes =...
80
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the...
0
by: Yahoo! Groups | last post by:
--qmZXHrzahTmnWjcAmzfDy9efU1qhZy1O5P65Uoe Content-Type: text/plain Content-Transfer-Encoding: 7bit We are unable to process the message from <mysql@freebsd.csie.nctu.edu.tw> to...
1
by: Vishal Sethia | last post by:
Just trying to understand the behaviour of spawn. Consider I have a function which creates two threads. And in one of the threads I make a call to pexpect.spawn. spawn would fork and create a new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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,...

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.