Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startProcessorDotNetService(){
- String currentServerHostname = "<remote_machine_ip>";
- String currentServerUser = "<user_name>";
- String currentServerPass="dyAf&E47p?s";
- String commandToStart="start serviceName";
- String commandToStop="stop serviceName";
- String psCommand ="<path_to_PSTools_directory>\psservice \\"+ currentServerHostname + " -u " + currentServerUser + " -p " + currentServerPass;
- psCommandStart = psCommand + " " + commandToStart;
- psCommandStop = psCommand + " " + commandToStop;
- serviceStart();
- // serviceStop();
- }
- private void serviceStart() {
- String[] command = {
- "cmd",
- };
- Process p;
- try{
- p=Runtime.getRuntime().exec(command);
- PrintWriter stdin = new PrintWriter(p.getOutputStream());
- stdin.println(psCommandStart);
- stdin.close();
- p.waitFor();
- }catch (Exception e){
- e.printStackTrace();
- }
- }
- The user name or password is incorrect.
- 'E47p?s' is not recognized as an internal or external command,
- operable program or batch file.
Add Comment
Please, Sign In to add comment