Not enough permission to run typeperf.exe

2019-07-21 14:30发布

问题:

Im Trying to run typeperf.exe with an php function exec();

this is the command ( for cpu load % ) typeperf -sc 1 "processor(_Total)\% Processor Time"

When im runing the command through a command prompt it is returning me the wanted result.

But when calling it trough exec(); Im getting

So I ran the command whoami through php to know what is the php user,

I got nt authority\iusr

So I setted the username to be in the Performance Log User Group as mentioned. And deseperatly added everyone in the group since this was not working.

What can I do to let php run a typeperf.exe comand ?

回答1:

You mention it does work when using command prompt. But even when using command prompt you need to start it as administrator (windows 8, possibly 7). If you dont you get the same error message.

So perhaps you could try to disable user account control to allow access without specific administrator privileges.. Check how-do-i-disable-administrator-prompt-in-windows-8 for some tips.

Also it mentions that the rights are only updated after logging in with the account. So it could very well be that your changes never do anything as you never log in using 'Everyone' or 'IUSR'.