0

I have a task that I need to run on an almost daily basis. I was hoping if there was CLi or bat file to do the same.

Task is:

  1. Open putty.exe
  2. connect to 192.168.0.2
  3. typing "login as" details
  4. sudo reboot

Thats it.

I want to give my client something that he can double click and it does the above with minimal-no user intervention at all.

Thank you in advance.

4
  • 4
    Ok but shouldn't you solve the problem that makes the daily reboot necessary, first? (Or if it is truly necessary, do it via crontab instead of manually?) Apr 16, 2022 at 7:36
  • Totally agree with @user1686 . That aside, you could do this fairly trivially using openssh instead of putty. Set up a public key login, then write a trivial script with the line ssh [email protected] "sudo reboot"
    – davidgo
    Apr 16, 2022 at 8:05
  • I understand @user1686. We are trying to resolve the daily reboot issue, till then I wanted to give a temporary solution for the problem. :) Apr 16, 2022 at 8:57
  • 2

1 Answer 1

0

Thanks to the various comments (especially @martin Prikryl who got me closer to the answer)

I installed plink.exe and used it create a command line

my bat file had plink.exe -ssh [email protected] -pw "password" sudo reboot exit

and running it worked perfectly.

Only downside is, I cant allow my client to know the password due to potential tinkering and messing up the setup we provided it to him.

Sadly converting it to an exe file gets it removed by Antivirus.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .