Access denied to Process.StartTime for User account

D

dfcastles

After upgrading to the DotNet Framework 2.0, my app now generates an
"Access Denied" exception when trying to look at the StartTime of
the processes running on a Win2K server. This code was running without
errors on the site using the DotNet Framwework 1.1. I am using the
System.Diagnostics.Process object to get a list of all running
processes and then looking through the list at the StartTime of each
Process.

....

System.Diagnostics.Process oCurProcess =
System.Diagnostics.Process.GetCurrentProcess();
System.Diagnostics.Process[] oProcessList;
oProcessList =
System.Diagnostics.Process.GetProcesses(oCurProcess.MachineName);

for(int p=0; p<oProcessList.Length; p++)
{
if (oProcessList[p].Id == iMRUProcessId)
{
System.TimeSpan oTimeSpan = oProcessList[p].StartTime -
dtMRUProcessStartTime;


On some other customer sites running Win 2003 Servers, we had to add
the users of the app to the Performance Log Users group in order to
read the StartTimes of the running processes. I would like to have the
app run on normal user acccounts but I keep running into permission
issues.

I've been testing some code to use impersonation to temporarily use
another user account to view the starttimes of the running processes,
but now have found that using the API call LogonUser (needed for
impersonation) requires the calling process to have the SE_TCB_NAME
(act as OS) priv on Win 2K Servers. It's a catch 22. MSFT warns about
granting this to a process due to its power, so it doesn't seem like
the thing to do for normal users.

Is there a way to tell if a particular ProcessId is still running and
for how long it has been running without having to grant super powers
to the users of the app? Any light shed, thoughts or ideas are
appreciated.

thanks
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top