code: private static String executePowerShellCommand(String command) {
          try {
              String[] commandList = {POWER_SHELL, POWER_SHELL_COMMAND, command};
              ProcessBuilder pb = new ProcessBuilder(commandList);
              Process process = pb.start();
  
              InputStream is = process.getInputStream();
              InputStreamReader isr = new InputStreamReader(is);
              BufferedReader br = new BufferedReader(isr);
  
              String line;
              while ((line = br.readLine()) != null) {
                  if (line.startsWith(COMMON_NAME_PARAMETER)) {
                      String[] values = line.split(COMMA_SPLIT);
                      return values[0].substring(values[0].indexOf(EQUAL_SPLIT) + 1);
                  }
              }
          } catch (Exception e) {
              // do nothing
          }
          return null;
      }
docs: Get the signature from file by execute process from power shell