public String runCommand(String shellId, String command, String[] args) { final boolean consoleModeStdin = true; final boolean skipCmdShell = false; String messageId = UUID.randomUUID().toString(); HashMap<String, String> options = new HashMap<>(); options.put("WINRS_CONSOLEMODE_STDIN", consoleModeStdin ? "TRUE" : "FALSE"); options.put("WINRS_SKIP_CMD_SHELL", skipCmdShell ? "TRUE" : "FALSE"); prepareRequest(URI_ACTION_SHELL_COMMAND, shellId, messageId, options); // add SOAP body CommandLine theCommand = new CommandLine(); theCommand.setCommand(command); theCommand.getArguments().addAll(Arrays.asList(args)); // ws call CommandResponse response = wsmanService.command(theCommand); return response.getCommandId(); }