Community discussions

MikroTik App
 
nosovk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jan 25, 2012 11:25 am
Location: Ukraine
Contact:

Manage routeros via CMD

Mon Sep 01, 2014 7:01 pm

Hello! I try to make some shortcut for employe to restars mikrotik AP.
I try to use API for that, but it seems there is no way to use .bat file, or smth. similar. If somebody has achived remote control of ROS without winbox, please tell how?
I know that I can write application on C, or delphi, but I'm sure that there is an more easy way.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Manage routeros via CMD

Mon Sep 01, 2014 7:25 pm

There's not exactly an easier way... In that you do need some sort of a "special" application to then connect to the router in some fashion and do the reboot. There's nothing built into Windows (if that's what you mean by "easier") that would suffice.

You could install something like PuTTY (or should I say "plink"), and create a bat-like file to contain the command, and run that, but this still means installing plink and the file, and wrapping up the call to plink in a bat file that would then call it with the appropriate arguments.


If you make a custom application (with the credentials and command hard coded; If you want to VERY easily make the application; making it configurable would be slightly harder), you could create a single exe, which would be all that's needed on a remote machine... Which may sound harder to do than the above, except not really... Not for a single purpose and simple application like that.
 
User avatar
CyberTod
Long time Member
Long time Member
Posts: 510
Joined: Wed Jan 25, 2012 10:23 am

Re: Manage routeros via CMD

Tue Sep 02, 2014 10:19 am

Maybe this will help you :

http://stackoverflow.com/questions/1319 ... -a-command

A few ways to to what you want with .bat + .vbs scripts or with a small external utility (i haven't tested it)
 
nosovk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jan 25, 2012 11:25 am
Location: Ukraine
Contact:

Re: Manage routeros via CMD

Tue Sep 02, 2014 2:09 pm

I try both utiliti and vbs script.
But no way - can't login.
The most common utility is http://support.moonpoint.com/downloads/ ... /tst10.php
But it seems that there is something withencoding in mikrotik telnet terminal, or who knows...
But only Putty can login via telnet - any other client fails.
I've attached some example script.
You do not have the required permissions to view the files attached to this post.
 
User avatar
CyberTod
Long time Member
Long time Member
Posts: 510
Joined: Wed Jan 25, 2012 10:23 am

Re: Manage routeros via CMD

Tue Sep 02, 2014 2:39 pm

It works. I tested it, but sometimes it can take 1min to finish. Maybe because it tries to draw the output, but it is not visible, also some mistakes in your script, should be :
192.168.22.1 23
WAIT "Login: "
SEND "admin\m"
WAIT "Password: "
SEND "noone\m"
WAIT "> "
SEND "/ip hotspot disable 0\m"
WAIT "> "
SEND "/ip hotspot enable 0\m"
 
nosovk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Wed Jan 25, 2012 11:25 am
Location: Ukraine
Contact:

Re: Manage routeros via CMD

Tue Sep 02, 2014 3:25 pm

Thank's a lot.
It seems that I just was to in a hurry to wait more. It really takes some time, but works :)
 
nonac
newbie
Posts: 27
Joined: Tue Sep 02, 2014 7:36 pm

Re: Manage routeros via CMD

Tue Sep 02, 2014 7:50 pm

great script

Who is online

Users browsing this forum: Majestic-12 [Bot] and 13 guests