WiseMo Guest Component API
Remote command console

Back to Index

This page describes param to InvokeRmOperation call and returned value from OnRmOperationResult for snapinId = 15008.

Note

When operation fails, OnRmOperationResult comes with non-zero status and Error object in value:

{
"Error" : {
"code" : 4101,
"message" : "Failed to send RM command"
}
}


When status is zero, value is as provided in following documentation.

Paged output

RM requests may yield lots of data so responses are restricted in size.
That's where StartAt, UpTo and Total are used.


StartAt


UpTo says which StartAt use next to continue data retrieval


Total says how many data at all. When UpTo equals to Total, then all data has been retrieved.

Operation: Check if supported

snapinId=15008 opId=0

Check if host supports Remote command console subsystem (Snap-In) for RM calls.

Parameters

{}

Returns

{
"Supported" : 1,
"Impersonate" : 1
}


Supported 1 if supports, 0 if not
Impersonate=1, if host is NT-like Windows (Windows 2000, WindowsXP etc.), 0 if not

Operation: Restart

snapinId=15008 opId=801

Starts/restarts command console process.

Parameters

{"Domain":"","Login":"testuser","Password":"123","UseHost":0,"LoadProfile":1}

Returns

null

Operation: Stop

snapinId=15008 opId=802

Stops command console process.

Parameters

{}

Returns

null

Operation: Write

snapinId=15008 opId=803

Sends keyboard input messages to remote command console.

Parameters (f.e. sequence for keys "dir[Enter]")

// Typing in "dir<Enter>"
{ "KeyEvents":[
{ "EventType": 1, "KeyCode": 68, "CharCode": 100, "SpecialKeys": 0},
{ "EventType": 0, "KeyCode": 68, "CharCode": 100, "SpecialKeys": 0},
{ "EventType": 1, "KeyCode": 73, "CharCode": 105, "SpecialKeys": 0},
{ "EventType": 0, "KeyCode": 73, "CharCode": 105, "SpecialKeys": 0},
{ "EventType": 1, "KeyCode": 82, "CharCode": 114, "SpecialKeys": 0},
{ "EventType": 0, "KeyCode": 82, "CharCode": 114, "SpecialKeys": 0},
{ "EventType": 1, "KeyCode": 13, "CharCode": 13, "SpecialKeys": 0},
{ "EventType": 0, "KeyCode": 13, "CharCode": 13, "SpecialKeys": 0}
] }


EventType is 1 for key press, 0 for key release
KeyCode is the keyCode field from the keydown Javascript event
CharCode is the which field from the keypress Javascript event
SpecialKeys is a logical OR of flags:

- 0x0001 right Alt pressed
- 0x0002 left Alt pressed
- 0x0004 right Ctrl pressed
- 0x0008 left Ctrl pressed
- 0x0010 Shift pressed
- 0x0020 NumLock on
- 0x0040 ScrollLock on
- 0x0080 CapsLock on

Returns

null

Operation: Read

snapinId=15008 opId=804

Reads command console screen buffer

This operation does not get response until remote screen has changed,
application should renew Read request when it gets result from the previous Read.

Parameters

{}

Returns

{
"Cursor" : {
"Size" : 25,
"Visible" : 1,
"X" : 40,
"Y" : 3
},
"Screen" : {
"Buffer" : [
[ "M", 7 ],
[ "i", 7 ],
[ "c", 7 ],
[ "r", 7 ],
[ "o", 7 ],
[ "s", 7 ],
[ "o", 7 ],
[ "f", 7 ],
[ "t", 7 ],
[ " ", 7 ],
[ "W", 7 ],
[ "i", 7 ],
[ "n", 7 ],
[ "d", 7 ],
[ "o", 7 ],
...
[ " ", 7 ],
[ " ", 7 ],
[ " ", 7 ]
],
"Height" : 25,
"Offset" : 0,
"SizeRestricted" : 0,
"Width" : 80
}
}


Cursor.Size Cursor.Visible - see CONSOLE_CURSOR_INFO Structure
Screen.Offset screen buffer can be too big to fit into one RM packet, if so it is sent only partially and additional requests should be made to retrieve the remainder, theirs responses will have Screen.Offset !=0
SizeRestricted - 1 if console resizing attempt failed (though it is not clear where console size can be specified)

Note

Read does not return untill there are some changes on the console screen. If you call InvokeRmOpeartion with Read without waiting for the previous Read result for that particular control, you will be given the same RequestID and you will eventually get the single Read response.

Operation: Check

snapinId=15008 opId=805

Checks whether command console process is still active

Parameters

{}

Returns

{"IsRunning":0,"ExitCode":0}

IsRunning - 1 if command console process is running
ExitCode - command console process exit code if exited, 259 (STILL_ACTIVE) if still running