Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws IOException, InterruptedException {
- String ip = "192.168.1.1";
- String userName = "username";
- String password = "password";
- // creating credentials
- Process p = Runtime.getRuntime().exec("cmdkey /generic:"+ip+" /user:"+userName+" /pass:"+password );
- p.destroy();
- Process exec = Runtime.getRuntime().exec("mstsc /v: "+ip+" /console");
- Thread.sleep(30000);
- // deleting credentials
- Process p1 = Runtime.getRuntime().exec("cmdkey /delete:"+ip);
- p1.destroy();
- }
Add Comment
Please, Sign In to add comment