I need to launch an external program, but I'm hitting a roadblock because that external program requires elevated privileges. Normally I would just do this:
require('child_process').spawn('C:\\Users\\me\\AppData\\Local\\Temp\\1131128-16232-bid56z__some_installer.exe');
But this throws an error because the external program requires elevated privileges. Some have suggested that I use the "runas" command, but I haven't had much success yet. No error is thrown, but the external program doesn't run either.
require('child_process').spawn('runas', ['/user:my_machine_name\\administrator', 'C:\\Users\\me\\AppData\\Local\\Temp\\1131130-18300-1wol3cr__some_installer.exe']);
I've also been trying the node-window module's "elevate" method. It seems to use batch and VB scripts to do its magic, and it comes very close to solving my problem. The issue with this solution is that the child process's "close" and "exit" events seem to trigger immediately, and I lose all communication with the child process. I presume this is because the child process is aware of only the batch cmd or vbs and not my actual external program.
For the moment, I'm at a dead end. I'm very much hoping someone has an ingenious idea.