mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Updated 'openuserdesktopurl' so that on Windows, it uses the task scheduler to spawn the target into the user desktop, as opposed to just impersonating the user.
This commit is contained in:
parent
f29271ec99
commit
40ae7f5bdd
1 changed files with 9 additions and 2 deletions
|
@ -1645,8 +1645,15 @@ function createMeshCore(agent)
|
||||||
try {
|
try {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
//child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ["/c", "start", url], { type: childProcess.SpawnTypes.USER, uid: require('user-sessions').Current().Active[0].SessionId });
|
var user = require('user-sessions').getUsername(require('user-sessions').consoleUid());
|
||||||
child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ["/c", "start", url], { type: childProcess.SpawnTypes.USER });
|
child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['cmd']);
|
||||||
|
child.stderr.on('data', function () { });
|
||||||
|
child.stdout.on('data', function () { });
|
||||||
|
child.stdin.write('SCHTASKS /CREATE /F /TN MeshChatTask /SC ONCE /ST 00:00 /RU ' + user + ' /TR "' + process.env['windir'] + '\\system32\\cmd.exe /C START ' + url + '"\r\n');
|
||||||
|
child.stdin.write('SCHTASKS /RUN /TN MeshChatTask\r\n');
|
||||||
|
child.stdin.write('SCHTASKS /DELETE /F /TN MeshChatTask\r\n');
|
||||||
|
child.stdin.write('exit\r\n');
|
||||||
|
child.waitExit();
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
child = require('child_process').execFile('/usr/bin/xdg-open', ['xdg-open', url], { uid: require('user-sessions').consoleUid() });
|
child = require('child_process').execFile('/usr/bin/xdg-open', ['xdg-open', url], { uid: require('user-sessions').consoleUid() });
|
||||||
|
|
Loading…
Add table
Reference in a new issue