mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	show rdp port on button and set rdpport in console (#5708)
* add rdpport to console Signed-off-by: si458 <simonsmith5521@gmail.com> * add port number to rdp connect button Signed-off-by: si458 <simonsmith5521@gmail.com> --------- Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
		
							parent
							
								
									aaff8232b0
								
							
						
					
					
						commit
						a2aed9e772
					
				
					 2 changed files with 40 additions and 1 deletions
				
			
		| 
						 | 
					@ -3767,7 +3767,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
 | 
				
			||||||
                if (require('os').dns != null) { availcommands += ',dnsinfo'; }
 | 
					                if (require('os').dns != null) { availcommands += ',dnsinfo'; }
 | 
				
			||||||
                try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
 | 
					                try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
 | 
				
			||||||
                if (process.platform == 'win32') {
 | 
					                if (process.platform == 'win32') {
 | 
				
			||||||
                    availcommands += ',cs,wpfhwacceleration,uac,volumes';
 | 
					                    availcommands += ',cs,wpfhwacceleration,uac,volumes,rdpport';
 | 
				
			||||||
                    if (bcdOK()) { availcommands += ',safemode'; }
 | 
					                    if (bcdOK()) { availcommands += ',safemode'; }
 | 
				
			||||||
                    if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
 | 
					                    if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
 | 
				
			||||||
                    try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
 | 
					                    try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
 | 
				
			||||||
| 
						 | 
					@ -4051,6 +4051,44 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
 | 
				
			||||||
            case 'timerinfo':
 | 
					            case 'timerinfo':
 | 
				
			||||||
                response = require('ChainViewer').getTimerInfo();
 | 
					                response = require('ChainViewer').getTimerInfo();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case 'rdpport':
 | 
				
			||||||
 | 
					                if (process.platform != 'win32') {
 | 
				
			||||||
 | 
					                    response = 'Unknown command "rdpport", type "help" for list of available commands.';
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (args['_'].length == 0) {
 | 
				
			||||||
 | 
					                    response = 'Proper usage: rdpport [get|default|PORTNUMBER]';
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    switch (args['_'][0].toLocaleLowerCase()) {
 | 
				
			||||||
 | 
					                        case 'get':
 | 
				
			||||||
 | 
					                            var rdpport = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber');
 | 
				
			||||||
 | 
					                            response = "Current RDP Port Set To: " + rdpport + '\r\n';
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        case 'default':
 | 
				
			||||||
 | 
					                            try {
 | 
				
			||||||
 | 
					                                require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber', 3389);
 | 
				
			||||||
 | 
					                                response = 'RDP Port Set To 3389, Please Dont Forget To Restart Your Computer To Fully Apply';
 | 
				
			||||||
 | 
					                            } catch (ex) {
 | 
				
			||||||
 | 
					                                response = 'Unable to Set RDP Port To: 3389';
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        default:
 | 
				
			||||||
 | 
					                            if (isNaN(parseFloat(args['_'][0]))){
 | 
				
			||||||
 | 
					                                response = 'Proper usage: rdpport [get|default|PORTNUMBER]';
 | 
				
			||||||
 | 
					                            } else if(parseFloat(args['_'][0]) < 0 || args['_'][0] > 65535) {
 | 
				
			||||||
 | 
					                                response = 'RDP Port Must Be More Than 0 And Less Than 65535';
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                try {
 | 
				
			||||||
 | 
					                                    require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp', 'PortNumber', parseFloat(args['_'][0]));
 | 
				
			||||||
 | 
					                                    response = 'RDP Port Set To ' + args['_'][0] + ', Please Dont Forget To Restart Your Computer To Fully Apply';
 | 
				
			||||||
 | 
					                                } catch (ex) {
 | 
				
			||||||
 | 
					                                    response = 'Unable to Set RDP Port To: '+args['_'][0];
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            case 'find':
 | 
					            case 'find':
 | 
				
			||||||
                if (args['_'].length <= 1) {
 | 
					                if (args['_'].length <= 1) {
 | 
				
			||||||
                    response = "Proper usage:\r\n  find root criteria [criteria2] [criteria n...]";
 | 
					                    response = "Proper usage:\r\n  find root criteria [criteria2] [criteria n...]";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8984,6 +8984,7 @@
 | 
				
			||||||
            var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
 | 
					            var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
 | 
				
			||||||
            QE('connectbutton1', online);
 | 
					            QE('connectbutton1', online);
 | 
				
			||||||
            QE('connectbutton1r', online || (currentNode.mtype == 3));
 | 
					            QE('connectbutton1r', online || (currentNode.mtype == 3));
 | 
				
			||||||
 | 
					            Q('connectbutton1r').value = 'RDP Connect' + ((currentNode.rdpport && currentNode.rdpport != 3389) ? ' ('+currentNode.rdpport + ')' : '');
 | 
				
			||||||
            var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
 | 
					            var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
 | 
				
			||||||
            QE('connectbutton1h', hwonline);
 | 
					            QE('connectbutton1h', hwonline);
 | 
				
			||||||
            QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
 | 
					            QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue