Windows – GetProcessesByName() and Windows Server 2003 scheduled task

.net-1.1permissionsscheduled-taskswindows

Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:

System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)

When NOT running as scheduled task i.e. under a logged in user, as long as the user is a member of "Performance Monitor Users", this code will not throw an exception.

When running as a scheduled task under the same user account, it fails.

The only way I can get it to work is to run it as a member of the Local Administrator group.

Any ideas?

Best Answer

My humblest apologies. The user I was using was NOT a member of "Performance Monitor Users" group.

This is necessary for .NET Framework 1.1 implementation of System.Diagnostics.

I have added the user to this group, and all is well.