Skip to main content
Version: 2.6

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".

AddressDescription
PowerShell.ExecuteScriptExecutes a Powershell script

Input parameters

ParameterDescriptionData Type
ScriptScript to execute as StringSystem.String
TimeoutInvocation timeout in millisecondsSystem.Int32

Output parameters

ParameterDescriptionData Type
ReturnValueListReturn-value list of PowerShell invocationSystem.String[]
ErrorInfoError informationSystem.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

ParameterDescriptionData Type
ScriptScript to execute as StringSystem.String
DelayInvocation delay in secondsSystem.Int32

Output parameters

ParameterDescriptionData Type
ReturnValueListReturn-value list of PowerShell invocationSystem.String[]
ErrorInfoError informationSystem.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.

AddressDescription
PowerShell.ExecuteScriptFileExecutes a PowerShell script read from a file

Input parameters

ParameterDescriptionData Type
FilePathFilepath of Script to executeSystem.String
EncodingFile Encoding parameterSystem.String
TimeoutInvocation timeout in millisecondsSystem.Int32

Output parameters

ParameterDescriptionData Type
ReturnValueListReturn-value list of PowerShell invocationSystem.String[]
ErrorInfoError informationSystem.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

AddressDescription
Process.StartOnly starts the process

Input parameters

ParameterDescriptionData Type
FileNameFile name to start (example: ipconfig.exe). For a custom application, the filepath must be includedSystem.String
ArgumentArguments for the ProcessSystem.String
WorkingDirectoryWorking directory of the applicationSystem.String
CreateNoWindowTrue = creates no window for this processSystem.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

AddressDescription
Process.StartAndWaitStarts the process and wait for its termination

Input parameters

ParameterDescriptionData Type
FileNameFile name to start (example: ipconfig.exe). For a custom application, the filepath must be includedSystem.String
ArgumentArguments for the ProcessSystem.String
WorkingDirectoryWorking directory of the applicationSystem.String
CreateNoWindowTrue = creates no window for this processSystem.Boolean
TimeoutTimeout in millisecondsSystem.Int32

Output parameters

ParameterDescriptionData Type
StandardOutputThe standard output from this processSystem.String
ErrorOutputThe error output for this processSystem.String
ExitCodeExit code of processSystem.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

AddressDescription
Process.StartAsUserOnly starts the process as specified user

Input parameters

ParameterDescriptionData Type
FileNameFile name to start (example: ipconfig.exe). For a custom application, the filepath must be includedSystem.String
ArgumentArguments for the ProcessSystem.String
WorkingDirectoryWorking directory of the applicationSystem.String
DomainDomain nameSystem.String
UserNameUser nameSystem.String
PasswordPasswordSystem.String
LoadUserProfileTrue = loads the user profile from the registrySystem.Boolean
CreateNoWindowTrue = creates no window for this processSystem.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

AddressDescription
Process.StartAndWaitAsUserStarts the process as user and wait for its termination

Input parameters

ParameterDescriptionData Type
FileNameFile name to start (example: ipconfig.exe). For a custom application, the filepath must be includedSystem.String
ArgumentArguments for the ProcessSystem.String
WorkingDirectoryWorking directory of the applicationSystem.String
DomainDomain nameSystem.String
UserNameUser nameSystem.String
PasswordPasswordSystem.String
LoadUserProfileTrue = loads the user profile from the registrySystem.Boolean
CreateNoWindowTrue = creates no window for this processSystem.Boolean
TimeoutTimeout in millisecondsSystem.Int32

Output parameters

ParameterDescriptionData Type
StandardOutputThe standard output from this processSystem.String
ErrorOutputThe error output for this processSystem.String
ExitCodeExit code of processSystem.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

ParameterDescriptionData Type
FileNameFile name on the hostSystem.String
ContentFile contentSystem.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"
}
]
}