mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 07:05:52 -05:00
Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
e2b7d38bc8
@ -2624,13 +2624,30 @@ function openUserDesktopUrl(url) {
|
|||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
var user = require('user-sessions').getUsername(require('user-sessions').consoleUid());
|
var user = require('user-sessions').getUsername(require('user-sessions').consoleUid());
|
||||||
child = require('child_process').execFile(process.env['windir'] + '\\system32\\cmd.exe', ['cmd']);
|
var taskoptions = { env: { _target: process.env['windir'] + '\\system32\\cmd.exe', _args: '/C START ' + url.split('&').join('^&'), _user: '"' + user + '"' } };
|
||||||
child.stderr.on('data', function () { });
|
for (var c1e in process.env)
|
||||||
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.split('&').join('^&') + '"\r\n');
|
taskoptions.env[c1e] = process.env[c1e];
|
||||||
|
}
|
||||||
|
var child = require('child_process').execFile(process.env['windir'] + '\\System32\\WindowsPowerShell\\v1.0\\powershell.exe', ['powershell', '-noprofile', '-nologo', '-command', '-'], taskoptions);
|
||||||
|
child.stderr.on('data', function (c) { });
|
||||||
|
child.stdout.on('data', function (c) { });
|
||||||
|
child.stdin.write('SCHTASKS /CREATE /F /TN MeshChatTask /SC ONCE /ST 00:00 ');
|
||||||
|
if (user) { child.stdin.write('/RU $env:_user '); }
|
||||||
|
child.stdin.write('/TR "$env:_target $env:_args"\r\n');
|
||||||
|
child.stdin.write('$ts = New-Object -ComObject Schedule.service\r\n');
|
||||||
|
child.stdin.write('$ts.connect()\r\n');
|
||||||
|
child.stdin.write('$tsfolder = $ts.getfolder("\\")\r\n');
|
||||||
|
child.stdin.write('$task = $tsfolder.GetTask("MeshChatTask")\r\n');
|
||||||
|
child.stdin.write('$taskdef = $task.Definition\r\n');
|
||||||
|
child.stdin.write('$taskdef.Settings.StopIfGoingOnBatteries = $false\r\n');
|
||||||
|
child.stdin.write('$taskdef.Settings.DisallowStartIfOnBatteries = $false\r\n');
|
||||||
|
child.stdin.write('$taskdef.Actions.Item(1).Path = $env:_target\r\n');
|
||||||
|
child.stdin.write('$taskdef.Actions.Item(1).Arguments = $env:_args\r\n');
|
||||||
|
child.stdin.write('$tsfolder.RegisterTaskDefinition($task.Name, $taskdef, 4, $null, $null, $null)\r\n');
|
||||||
|
|
||||||
child.stdin.write('SCHTASKS /RUN /TN MeshChatTask\r\n');
|
child.stdin.write('SCHTASKS /RUN /TN MeshChatTask\r\n');
|
||||||
child.stdin.write('SCHTASKS /DELETE /F /TN MeshChatTask\r\n');
|
child.stdin.write('SCHTASKS /DELETE /F /TN MeshChatTask\r\nexit\r\n');
|
||||||
child.stdin.write('exit\r\n');
|
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
|
Loading…
Reference in New Issue
Block a user