0

I fail to execute chef recipe with the command chef-client.bat -z -o "recipe[cookbook::recipe]" inside java method in specific folder (e.g C:\CItool\chef-project. The problem is that chef-client.bat requires to be run as Administrator. How can I do that ?

String line;
Process process=Runtime.getRuntime()
                       .exec("chef-client.bat -z -o \"recipe[cookbook::recipe]\"",
                              null, new File("C:\CItool\chef-project"));
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((line = input.readLine()) != null) {
    System.out.print(line);
}
MarianD
  • 13,096
  • 12
  • 42
  • 54
Philip St
  • 81
  • 10
  • https://stackoverflow.com/questions/14596599/run-command-prompt-as-administrator – asifrc Jun 02 '17 at 14:38
  • Removing the chef tags as this is not a question about Chef beyond the incidental fact that Chef needs to be run as an admin account. – coderanger Jun 02 '17 at 16:02

0 Answers0