|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get the Process Name with minimal privilege?System.Diagnostics.Process.GetCurrentProcess().ProcessName fails for a caller with minimal privilege on Windows 2003 Server: System.InvalidOperationException - Couldn't get process information from remote machine. System.ComponentModel.Win32Exception - Access is denied. It works ok on Windows 2000 Professional. A web search concerning this issue suggests that this is considered to be a bug in 2003 Server in some quarters. The only work-around that I've come across so far is to grant the caller access to the performance counters. This is unacceptable. Can anyone suggest another way for a caller with minimal privilege to discover the name of the Win32 process within which it is executing? I don't mind if it involves Interop, just as long as it works with minimal privilege. Thanks David Razzetti Hi David,
The System.Diagnostics.Process Class uses performance data to obtain information on processes on the system. So the user needs to be added to the "Performance Monitor Users" Group to call run the Process.GetCurrentProcess.ProcessName. If you do not want to add the user into the group and you just want to get the process name. You may try to use System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase and parse the process name which is the exe file name. Best regards, Peter Huang Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights. |
|||||||||||||||||||||||