Community discussions

MUM Europe 2020
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Notification (Execute locally: run a vbs script)

Fri Jan 16, 2009 7:31 pm

Dude is running as a service.
The Notification should execute a local vbs script:
wscript C:\WriteSMSFile\WriteSMSFile.vbs //B "44999999999" "[Device.Name] [Service.Status] [Service.ProblemDescription]"

The problem is that the script gets only executed as long the control Panel of the dude is running.

Anyone knows a solution for this?
 
User avatar
sady
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Jul 11, 2008 11:30 am
Location: Russia

Re: Notification (Execute locally: run a vbs script)

Sun Jan 18, 2009 6:17 pm

may be you should try to use "start" command, instead wscript directly?
like
start wscript <>

it also may be problem with desktop interaction. try to experiment with service parameters.
Please, please, Open Dude Source! Pleaaaaseeeee!!!!!
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Sun Jan 18, 2009 6:32 pm

thank you for the reply.
I tried with the start command, no difference, the same thing with the dude service (interact with desktop).
I don't know what i could try else...
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Sun Jan 18, 2009 11:54 pm

Any reason you have the 2 forward slashes in there before the "B" ?
We use server executed notifications constantly with no issues, here is an example of our batch file.

d:\mgmtapps\smssender\smssender.exe username password mobilenumber "Service [Probe.Name] on [Device.Name] ([Device.AddressesCommaList]) [Device.CustomField1] is [Service.Status], Contact: [Device.CustomField3] [Device.CustomField2]]"

This works perfectly and has done for ages, if you run your command from start/run in windows using the identical command as you are trying to use in your batch file, does it work fine ?

We run dude in service mode also, it is possible, although it shouldn't be required, you may need to set the service to login with a user with higher privilages that systemaccount, just a thought.

Regards
Paul
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Mon Jan 19, 2009 10:07 am

Two forward slashes, see help wscript.

I can start the script without any problems from the command line, and it works also when the control panel of the dude is open, that confuses me.

started the Service also with an user with admin rights, no difference...
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Mon Jan 19, 2009 10:21 am

I only just noticed this, have you tried the full path for wscript in the command ?

c:\windows\system32\wscript C:\WriteSMSFile\WriteSMSFile.vbs //B "44999999999" "[Device.Name] [Service.Status] [Service.ProblemDescription]"

I did have a problem with this, you have to have the full path.

Regards
Paul
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Mon Jan 19, 2009 11:20 am

Thanks Paul for the suggestion.

I also tried this one:
c:\windows\system32\wscript C:\WriteSMSFile\WriteSMSFile.vbs //B "44999999999" "[Device.Name] [Service.Status] [Service.ProblemDescription]"

Sadly the same result, script is working when the dude is open but when it's closed, nothing happens.
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Mon Jan 19, 2009 3:53 pm

Are you running the dude server and client on the same machine ?
Are you running dude server as an application or service ?

Regards
Paul
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Mon Jan 19, 2009 5:13 pm

Are you running the dude server and client on the same machine ?
Yes
Are you running dude server as an application or service ?
As a Service

But the script gets only executed when i launch dude as an application.
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 10:09 am

Does anyone know a other way to write a text file?
I also tried with echo bla bla bla >sms.txt but this didn't work either. That was the reason i wrote a vbs script which save the arguments to a text file.
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 11:09 am

Seriously ?, use notepad or wordpad

Paul
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24424
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 11:11 am

lol pjulian :)

please repeat your objective in simple words - what do you need to write to file, and why?
No answer to your question? How to write posts
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 11:58 am

@pjulian good joke:-(

I would like to send a sms with SMS Server Tools 3, for this to work i need to place a text file with [Device.Name] [Service.Status] [Service.ProblemDescription] in a folder.
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 12:05 pm

Sorry, I had to dig :-)

So when a device goes down, you want to create a text file with certain information in it to use as a config/parameters file for your SMS sending application, is that correct ?

If so, do they have to be on separate lines or simply one after the other or comma separated etc ?

Do you have any example of a format that actually works, excluding The Dude in this instance ?

Regards
Paul
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 12:18 pm

@Paul no problem

The format of the sms textfile should look like this (3 Lines: Nr, empty, smstext):

To: 491721234567

Hello, this is the sms.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24424
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 12:29 pm

OK, i worked it out:

1. Run dude in administrator mode (right click, run as administrator)
2. Then dude will be able to run tools like this:
cmd.exe /k echo [Device.FirstAddress] > test.txt
No answer to your question? How to write posts
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 12:53 pm

Same Problem as I described in my first post.
It only works when you run dude as an application but it should also work when dude is running as a service.
 
pjulian
Member Candidate
Member Candidate
Posts: 267
Joined: Mon May 31, 2004 12:16 pm
Location: Sydney, Australia

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 1:01 pm

Good one Normis, not a bad solution, however, I would probably do it slightly differently, but I suppose it would achieve the same result at the end of the day.

Create a batch file called whatever you want, lets say SMS.BAT or SMS.CMD, whichever you prefer.
In The Dude, make your alert command like this "SMS.BAT [Device.Name] [Service.Status] [Service.ProblemDescription]"
The the contents of the batch file could be:

DRIVE:\PATH\smsprogram.exe mobilenumber %1 %2 %3

Plus whatever other info you need in there.

Running a batch file definately works as I use that method for alerts, that is in V2.2 anyway running as a service.

This is of course assuming you can do it without your text file and just from the command line, I would imagine so.

Regards
Paul
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 7:07 pm

Sadly the same problem.
I tried to start a batch file (without any arguments) which would do the following:
echo "to:41123456789) >c:\sms\smstext.txt

I can start the batch file from command line without any problem but it stops working after i run dude as a service(tested on two different dude systems).

Yes Paul, i can start a Batch file, for example i Force the Update Detection from Automatic Update, which wouldn't make any sense for notification, but it's only a test.
Content of the Batch file:
wuauclt /detectnow

You can see that wuauclt.exe appears as a process.

This works when dude is running as a service, but as soon i'm trying to write to a file, nothing happens.
 
missinlnk
Member Candidate
Member Candidate
Posts: 113
Joined: Wed Aug 13, 2008 8:10 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 7:41 pm

What permissions is the dude service running with? Admin rights or is it running with different permissions? Could there be permissions errors with it writing to the file? Have you looked to see if there are any errors in the system's Error Log?
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Wed Jan 21, 2009 9:56 pm

I also tried to run the service with an admin account, it doesn't had any effect.
I couldn't find any entry in the event log ether.
 
Tristan99
just joined
Topic Author
Posts: 12
Joined: Fri Jan 16, 2009 7:18 pm

Re: Notification (Execute locally: run a vbs script)

Tue Feb 03, 2009 11:44 am

Finally everything works well when I install dude with srvany (Windows Server Resource Kit) as a Service?!?
http://wiki.mikrotik.com/wiki/Dudes_as_ ... ws_service

So something seems to be different to original service mode from dude..

Anyway I'm happy to found a solution that works.

Who is online

Users browsing this forum: No registered users and 9 guests