After spending almost 5 days on it I found a solution to do this. To Enable/Disable task on Task scheduler you have to run Enable/Disable (“c:\windows\system32\schtasks.exe /Change /TN openChrome /Enable”) command on administrator privileges. One could run administrator commands by running command prompt as administrator. But it is difficult to run administrator commands from php.
So for both, either you want to run cmd.exe commands or schtasks.exe commands as administrator from php, you just need to copy cmd.exe or schtasks.exe files from C:\Windows\System32 and paste to some other directory. For Example, I paste that to D:\ drive.
Now right click on that.
Go to Compatibility tab.
Check “Run this program as an administrator”.
Now go to your PHP file and use that path before command where you pasted cmd or schtasks file. (i.e, in my case I pasted SCHTASKS file in D:. So, now my command $cmd = “D:\SCHTASKS /Change /TN openChrome /Enable”).
This method run all your SCHTASKS or cmd commands as administrator from PHP exec() or shell_exec() functions.
Note: The only purpose of coping file from C:\Windows\System32 is, in that folder you can’t find compatibility tab in properties and there is no option to run always as administrator. I don’t know whether this method is secure or not.