/** * get user group on remote windows host * @return list of groups + user person * @throws JSchException * @throws IOException */ List<String> getUserGroups() throws JSchException, IOException { if ( userGroups == null ) { StringBuilder output = new StringBuilder(); int code = this.executeCommand( WHO_AMI_GROUPS_FO_LIST, output ); if ( code != 0 ) { throw new JSchException( "Could not get the groups of the current user (error code: " + code + ")" ); } this.userGroups = getUserGroups( output.toString() ); userGroups.add( getUser() ); } return this.userGroups; }