HostControl Commands
PowerShell
The PowerShell command allows to execute PowerShell scripts on local machine in user context of the HumanOS application. For this feature the plugin requires a valid license.
ExecuteScript
This command executes a script presented by the input parameter "Script". For this command, the parameter "FilePath" is not important. If the command had errors, the optional parameter "ErrorInfo" contains some information about the error. The return values of the Powershell executer are listed in output parameter "ReturnValueList".
Address | Description |
---|---|
PowerShell.ExecuteScript | Executes a Powershell script |
Input parameters
Parameter | Description | Data Type |
---|---|---|
Script | Script to execute as String | System.String |
Timeout | Invocation timeout in milliseconds | System.Int32 |
Output parameters
Parameter | Description | Data Type |
---|---|---|
ReturnValueList | Return-value list of PowerShell invocation | System.String[] |
ErrorInfo | Error information | System.String |
ExecuteDelayedScript
Executes a script asynchronously after n-seconds. The method returns immediately after firing the script call. Therefore, no output values are returned.
Input parameters
Parameter | Description | Data Type |
---|---|---|
Script | Script to execute as String | System.String |
Delay | Invocation delay in seconds | System.Int32 |
Output parameters
Parameter | Description | Data Type |
---|---|---|
ReturnValueList | Return-value list of PowerShell invocation | System.String[] |
ErrorInfo | Error information | System.String |
Example of a delayed script execution:
{
"Name": "ExecuteDelayedScript",
"Id": "E5E9A472-F41E-4879-B8F3-55EACDFC400E",
"Type": "CommandNode",
"Address": "PowerShell.ExecuteDelayedScript",
"Arguments": [
{
"Name": "Script",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Delay",
"Type": "Input",
"DataType": "System.Int32"
},
{
"Name": "ReturnValueList",
"Type": "Output",
"DataType": "System.String[]"
},
{
"Name": "ErrorInfo",
"Type": "Output",
"DataType": "System.String"
}
]
}
ExecuteScriptFile
This command does the same as "ExecuteScript", only the script is saved in a file. The parameter "FilePath" contains the path of the File. For this command, the parameter "Script" is unimportant.
Address | Description |
---|---|
PowerShell.ExecuteScriptFile | Executes a PowerShell script read from a file |
Input parameters
Parameter | Description | Data Type |
---|---|---|
FilePath | Filepath of Script to execute | System.String |
Encoding | File Encoding parameter | System.String |
Timeout | Invocation timeout in milliseconds | System.Int32 |
Output parameters
Parameter | Description | Data Type |
---|---|---|
ReturnValueList | Return-value list of PowerShell invocation | System.String[] |
ErrorInfo | Error information | System.String |
Example:
{
"Name": "ExecuteDelayedScript",
"Id": "E5E9A472-F41E-4879-B8F3-55EACDFC400E",
"Type": "CommandNode",
"Address": "PowerShell.ExecuteScriptFile",
"Arguments": [
{
"Name": "FilePath",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "ReturnValueList",
"Type": "Output",
"DataType": "System.String[]"
},
{
"Name": "ErrorInfo",
"Type": "Output",
"DataType": "System.String"
}
]
}
Process
The Process command allows to start windows processes on local machine in context of any user. Per default in same user context as HumanOS instance. For this feature the plugin requires a valid license.
Start
This command starts a windows process. The process name is given by the necessary input parameter "FileName". The parameter "Arguments" and "WorkingDirectory" can be an empty string, but they must be defined in the device xml.
For this command, there are no output parameters.
Address
Address | Description |
---|---|
Process.Start | Only starts the process |
Input parameters
Parameter | Description | Data Type |
---|---|---|
FileName | File name to start (example: ipconfig.exe). For a custom application, the filepath must be included | System.String |
Argument | Arguments for the Process | System.String |
WorkingDirectory | Working directory of the application | System.String |
CreateNoWindow | True = creates no window for this process | System.Boolean |
Example:
{
"Name": "Start process",
"Id": "179035F5-68E8-4098-85FA-ED2567B56D0B",
"Type": "CommandNode",
"Address": "Process.Start",
"Arguments": [
{
"Name": "FileName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Argument",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "WorkingDirectory",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "CreateNoWindow",
"Type": "Input",
"DataType": "System.Boolean"
}
]
}
StartAndWait
This command starts a windows process and wait for its termination. If the process is not finished until timeout expires, it will kill the process. The process name is given by the necessary input parameter "FileName". The parameter "Arguments" and "WorkingDirectory" can be an empty string, but they must be defined in the device xml.
Address
Address | Description |
---|---|
Process.StartAndWait | Starts the process and wait for its termination |
Input parameters
Parameter | Description | Data Type |
---|---|---|
FileName | File name to start (example: ipconfig.exe). For a custom application, the filepath must be included | System.String |
Argument | Arguments for the Process | System.String |
WorkingDirectory | Working directory of the application | System.String |
CreateNoWindow | True = creates no window for this process | System.Boolean |
Timeout | Timeout in milliseconds | System.Int32 |
Output parameters
Parameter | Description | Data Type |
---|---|---|
StandardOutput | The standard output from this process | System.String |
ErrorOutput | The error output for this process | System.String |
ExitCode | Exit code of process | System.Int32 |
Example:
{
"Name": "Start process",
"Id": "179035F5-68E8-4098-85FA-ED2567B56D0B",
"Type": "CommandNode",
"Address": "Process.StartAndWait",
"Arguments": [
{
"Name": "FileName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Argument",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "WorkingDirectory",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "CreateNoWindow",
"Type": "Input",
"DataType": "System.Boolean"
},
{
"Name": "Timeout",
"Type": "Input",
"DataType": "System.Int32"
},
{
"Name": "StandardOutput",
"Type": "Output",
"DataType": "System.String"
},
{
"Name": "ErrorOutput",
"Type": "Output",
"DataType": "System.String"
},
{
"Name": "ExitCode",
"Type": "Output",
"DataType": "System.Int32"
}
]
}
StartAsUser
This command starts a windows process in context of a specified user. The process name is given by the necessary input parameter "FileName". The parameter "Arguments" and "WorkingDirectory" can be an empty string, but they must be defined in the device xml.
For this command, there are no output parameters.
Address
Address | Description |
---|---|
Process.StartAsUser | Only starts the process as specified user |
Input parameters
Parameter | Description | Data Type |
---|---|---|
FileName | File name to start (example: ipconfig.exe). For a custom application, the filepath must be included | System.String |
Argument | Arguments for the Process | System.String |
WorkingDirectory | Working directory of the application | System.String |
Domain | Domain name | System.String |
UserName | User name | System.String |
Password | Password | System.String |
LoadUserProfile | True = loads the user profile from the registry | System.Boolean |
CreateNoWindow | True = creates no window for this process | System.Boolean |
Example:
{
"Name": "Start process",
"Id": "179035F5-68E8-4098-85FA-ED2567B56D0B",
"Type": "CommandNode",
"Address": "Process.StartAndWait",
"Arguments": [
{
"Name": "FileName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Argument",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "WorkingDirectory",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "CreateNoWindow",
"Type": "Input",
"DataType": "System.Boolean"
},
{
"Name": "Domain",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "UserName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Password",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "LoadUserProfile",
"Type": "Input",
"DataType": "System.Boolean"
}
]
}
StartAndWaitAsUser
This command starts a windows process in context of a specified user and wait for its termination. If the process is not finished until timeout expires, it will kill the process. The process name is given by the necessary input parameter "FileName". The parameter "Arguments" and "WorkingDirectory" can be an empty string, but they must be defined in the device xml.
Address
Address | Description |
---|---|
Process.StartAndWaitAsUser | Starts the process as user and wait for its termination |
Input parameters
Parameter | Description | Data Type |
---|---|---|
FileName | File name to start (example: ipconfig.exe). For a custom application, the filepath must be included | System.String |
Argument | Arguments for the Process | System.String |
WorkingDirectory | Working directory of the application | System.String |
Domain | Domain name | System.String |
UserName | User name | System.String |
Password | Password | System.String |
LoadUserProfile | True = loads the user profile from the registry | System.Boolean |
CreateNoWindow | True = creates no window for this process | System.Boolean |
Timeout | Timeout in milliseconds | System.Int32 |
Output parameters
Parameter | Description | Data Type |
---|---|---|
StandardOutput | The standard output from this process | System.String |
ErrorOutput | The error output for this process | System.String |
ExitCode | Exit code of process | System.Int32 |
Example:
{
"Name": "Start process",
"Id": "179035F5-68E8-4098-85FA-ED2567B56D0B",
"Type": "CommandNode",
"Address": "Process.StartAndWait",
"Arguments": [
{
"Name": "FileName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Argument",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "WorkingDirectory",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "CreateNoWindow",
"Type": "Input",
"DataType": "System.Boolean"
},
{
"Name": "Domain",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "UserName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Password",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "LoadUserProfile",
"Type": "Input",
"DataType": "System.Boolean"
},
{
"Name": "Timeout",
"Type": "Input",
"DataType": "System.Int32"
},
{
"Name": "StandardOutput",
"Type": "Output",
"DataType": "System.String"
},
{
"Name": "ErrorOutput",
"Type": "Output",
"DataType": "System.String"
},
{
"Name": "ExitCode",
"Type": "Output",
"DataType": "System.Int32"
}
]
}
Useful commands:
Default printer: FileName = "wmic.exe" Argument = printer where name='printer' call setdefaultprinter
.
File Handling
The file handling of host control allows to access and manipulate files on the host.
Download File
Downloading files to the host:
Input parameters
Parameter | Description | Data Type |
---|---|---|
FileName | File name on the host | System.String |
Content | File content | System.String |
TransportFormat | (Optional) Format of the file content. “Base64” : base64 encoded content used to transfer binary files, but also xml content. | System.String |
Encoding | (Optional) Encoding of text file (“UTF-8”, “ASCII”, “UTF-16”) | System.String |
Example:
{
"Name": "WriteFile",
"Id": "179035F5-68E8-4098-85FA-ED2567B56D0B",
"Type": "CommandNode",
"Address": "File.WriteFile",
"Arguments": [
{
"Name": "FileName",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Content",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "Encoding",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "TransportFormat",
"Type": "Input",
"DataType": "System.String"
}
]
}