使用PHP exec()的权限问题

I am trying to use PHP exec to call a function, generate a file and return it.

I can run the command directly from command line (the exact command which is also executed by PHP) and it works, no problems.

When I then try and execute the same command via PHP, I get a permissions error - I guess this is because the PHP user is different to the user I'm using and therefore the permissions are also different.

So my question really is, how can I change the user, used by PHP to call exec() functions? Or how can I find out specifically the permissions issue and rectify it?

I'm running PHP v7.0.21, on IIS, Windows Server 2016.

Thanks in advance