3

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.

enter image description here

But when calling it trough exec(); Im getting

enter image description here

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.

enter image description here

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

zx81
  • 41,100
  • 9
  • 89
  • 105
Nicolas Racine
  • 1,031
  • 3
  • 13
  • 35

1 Answers1

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'.

Community
  • 1
  • 1
Hugo Delsing
  • 13,803
  • 5
  • 45
  • 72
  • How may I log in with IUSR so right can be reloaded? – Nicolas Racine May 06 '14 at 00:57
  • You cant. I guess your best bet would be to create a new user `IUSR_Special` and add it to the `IIS_IUSRS` and `Performance Log User` groups. Login with it once and then set your webserver to use this account. The `IUSR` account is virtual and cannot be changed and its also added to the `Guests` group which limits its rights. – Hugo Delsing May 06 '14 at 07:02
  • I tried to change the user that the website run on in iis to mine and still it doesnt work iis still say nt autority iusr and when I make the process sleep(100) and go in the task manager I clearly see that it my user runing the process,. I do not know what to do any more lol. – Nicolas Racine May 09 '14 at 19:57
  • Then i'm running out of options. You did disable the admin prompt? It works for me without it. You could try to create a seperate script that first raises the admin level: http://stackoverflow.com/questions/5944180/how-do-you-run-a-command-as-an-administrator-from-the-windows-shell – Hugo Delsing May 11 '14 at 20:32