// create a wsman Shell instance; @see https://msdn.microsoft.com/en-us/library/cc251739.aspx public String openShell() { final boolean noprofile = false; // @TODO@ make param final int codepage = 437; // @TODO@ make param String messageId = UUID.randomUUID().toString(); HashMap<String, String> options = new HashMap<>(); options.put("WINRS_NOPROFILE", noprofile ? "TRUE" : "FALSE"); options.put("WINRS_CODEPAGE", String.valueOf(codepage)); prepareRequest(URI_ACTION_CREATE, null, messageId, options); // add SOAP body Shell shell = new Shell(); shell.getOutputStreams().add("stdout stderr"); shell.getInputStreams().add("stdin"); // shell.setEnvironment(); // shell.setIdleTimeout(); // shell.setWorkingDirectory(); // ws call CreateResponseType response = wsmanService.create(shell); Shell sh = (Shell) response.getAny(); return sh.getShellId(); // @TODO@ get shellId (from response) }