Ir ao conteúdo

Verificar se um processo está execução e notificar via e-mail no Windows

Olá,

Recentemente meu primo precisou um Visual Basic Script que verifica se um processo está executando e caso esteja envie um e-mail. Ele me pediu ajuda para criar este script e eu resolvi ajudar.

Visual Basic Script para verificação de processo em execução e notificação via E-mail.

Verificar se um processo está em execução com Visual Basic Script e mostrar uma janela se estiver.
[code lang=”vb”]
set service = GetObject (“winmgmts:”)
for each Process in Service.InstancesOf (“Win32_Process”)
If Process.Name = processName then
wscript.echo “Notepad running”
wscript.quit
End If
next
[/code]

Enviar e-mail utilizando Visual Basic Script:
[code lang=”vb”]
Const username = “SENHA”
Const password = “PASSWORD”
Const smtpServer = “smtp.gmail.com”
Const port = 465
Const secure = True
Const userFrom = “FROM”
Const userTo = “TO”
Const emailSubject = “Subject”
Const emailText = “Text”

‘== CODE ==

Const cdoSendUsingPickup = 1 ‘Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 ‘Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 ‘Do not authenticate
Const cdoBasic = 1 ‘basic (clear-text) authentication
Const cdoNTLM = 2 ‘NTLM

Set objMessage = CreateObject(“CDO.Message”)
objMessage.Subject = emailSubject
objMessage.From = userFrom
objMessage.To = userTo
objMessage.TextBody = emailText

‘==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2

‘Name or IP of Remote SMTP Servesr
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = smtpServer

‘Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”) = cdoBasic

‘Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = username

‘Your password on the SMTP server
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = password

‘Server port (typically 25)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = port

‘Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = secure

‘Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout”) = 60

objMessage.Configuration.Fields.Update

objMessage.Send
[/code]

Estes dois scripts foram mesclados para realizar o que precisávamos.

Abraços,
Matheus

Referencias:
http://wiki.imacros.net/send-email.vbs
http://www.techimo.com/forum/applications-operating-systems/117464-need-vbulletin-script-check-see-if-process-running.html

Publicado emwindows

1.033 Comentários

  1. Hello! This is my first comment here so I just wanted
    to give a quick shout out and tell you I really enjoy reading your blog posts.
    Can you suggest any other blogs/websites/forums that go over the same subjects?
    Many thanks!

  2. An impressive share! I have just forwarded this onto a coworker who
    was doing a little homework on this. And he actually
    ordered me dinner due to the fact that I found it
    for him… lol. So allow me to reword this…. Thanks for the
    meal!! But yeah, thanx for spending time to talk about this subject here on your blog.

  3. hey there and thank you for your info – I’ve definitely picked up anything new from right here.

    I did however expertise several technical points using this web site,
    since I experienced to reload the site a lot of times previous to I
    could get it to load correctly. I had been wondering if your web host is
    OK? Not that I’m complaining, but sluggish loading instances times will very
    frequently affect your placement in google and can damage your high-quality score if ads and marketing with
    Adwords. Well I am adding this RSS to my email
    and can look out for a lot more of your respective fascinating content.
    Ensure that you update this again very soon.

  4. I was recommended this website by way of my cousin. I
    am not certain whether or not this publish is written through
    him as no one else recognize such exact about my trouble.
    You are wonderful! Thanks!

  5. The passion of OMT’s owner, Mr. Justin Tan, radiates tһrough in trainings, encouraging Singapore traineds tо fall
    for math for examination success.

    Dive іnto seⅼf-paced mathematics proficiency ᴡith OMT’ѕ 12-month e-learning courses, tօtɑl ѡith practice worksheets аnd recorded sessions f᧐r comprehensive revision.

    In Singapore’ѕ strenuous education system, wһere mathematics іѕ mandatory
    аnd takes in ɑrߋᥙnd 1600 һours of curriculum
    time іn primary and secondary schools, math tuition еnds
    սp being vital tօ help students build a strong foundation fߋr ⅼong-lasting success.

    Tuition emphasizes heuristic рroblem-solving ɑpproaches,
    essential fоr dealing with PSLE’ѕ difficult ᴡord issues
    thаt require ѕeveral steps.

    Offered tһe hiցh stakes of O Levels fοr hіgh school development іn Singapore, math
    tuition maximizes possibilities fօr t᧐p grades and preferred positionings.

    Junior college math tuition advertises collaborative learning іn tiny teams, enhancing peer discussions οn facility A Level ideas.

    Tһe diversity оf OMT originates fгom its curriculum that enhances MOE’s tһrough interdisciplinary connections, linking math tⲟ science and everyday analytic.

    Interactive tools mаke learning enjoyable lor, ѕⲟ
    you гemain inspired and watch yoᥙr math grades climb continuously.

    Ӏn Singapore’s affordable education ɑnd learning landscape, math tuition ⲣrovides
    the additional edge required fߋr pupils to master һigh-stakes
    tests like the PSLE, O-Levels, аnd A-Levels.

    Look іnto my web-site … singapore tuition

  6. I feel this is among the most significant information for me.

    And i’m satisfied studying your article. But wanna statement on some normal issues,
    The site taste is great, the articles is in point of fact nice : D.
    Excellent process, cheers

  7. An impressive share! I have just forwarded this onto
    a colleague who had been conducting a little research on this.
    And he actually bought me dinner simply because
    I found it for him… lol. So allow me to reword this….
    Thank YOU for the meal!! But yeah, thanks for spending the time
    to discuss this subject here on your web site.

  8. I’m amazed, I must say. Seldom do I come across a blog that’s both
    equally educative and entertaining, and without a doubt, you’ve hit the nail on the head.

    The issue is something which not enough men and women are speaking intelligently about.
    I am very happy that I found this during my hunt for something
    regarding this.

  9. Thanks for the auspicious writeup. It in fact was once a entertainment account it.
    Glance complicated to more brought agreeable from you!
    By the way, how could we keep in touch?

  10. Excellent website. Lots of useful info here. I am sending it to several buddies ans also
    sharing in delicious. And obviously, thanks in your sweat!

  11. Nice blog! Is your theme custom made or did you download
    it from somewhere? A design like yours with a few simple adjustements would really make my blog jump out.
    Please let me know where you got your theme. Appreciate it

  12. naturally like your web site but you need to test the spelling on several of your posts.
    Several of them are rife with spelling issues and I to find it very troublesome to tell the truth then again I’ll
    surely come again again.

  13. you are really a excellent webmaster. The website loading pace is incredible.
    It seems that you are doing any distinctive trick. Furthermore, The contents
    are masterwork. you’ve done a great activity on this subject!

  14. The other day, while I was at work, my sister stole my iphone and tested to see if it can survive a 30 foot drop,
    just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is completely off topic but I had to share
    it with someone!

  15. Woah! I’m really enjoying the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s very hard to
    get that “perfect balance” between superb usability and visual appearance.

    I must say that you’ve done a great job with this.
    Additionally, the blog loads super quick for me on Safari.
    Exceptional Blog!

  16. I visited various web pages but the audio feature for audio songs present at this web site
    is really wonderful.

  17. Good day I am so glad I found your weblog, I really found
    you by error, while I was searching on Bing for something else, Nonetheless
    I am here now and would just like to say many thanks
    for a marvelous post and a all round exciting blog (I also love the theme/design), I don’t have time
    to read through it all at the minute but I have book-marked it and also included your RSS
    feeds, so when I have time I will be back to read more, Please do keep
    up the awesome work.

  18. We absolutely love your blog and find almost all of your post’s to be exactly I’m looking for.
    Do you offer guest writers to write content for you personally?
    I wouldn’t mind producing a post or elaborating on a few of
    the subjects you write about here. Again, awesome weblog!

  19. Does your site have a contact page? I’m having problems locating it but, I’d like to send you an e-mail.
    I’ve got some suggestions for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it expand
    over time.

  20. Hi, I think your site might be having browser compatibility issues.

    When I look at your website in Firefox, it
    looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, excellent blog!

  21. I don’t even know how I ended up here, but I thought this
    post was great. I do not know who you are but certainly you’re
    going to a famous blogger if you are not already 😉 Cheers!

  22. After I originally commented I seem to have clicked the -Notify me when new comments are added-
    checkbox and now each time a comment is added I recieve four emails with the
    same comment. Perhaps there is an easy method you can remove me from that service?
    Many thanks!

  23. Hi, I do think this is an excellent site. I stumbledupon it 😉 I’m going
    to come back yet again since I book marked it. Money and
    freedom is the greatest way to change, may you be rich and
    continue to guide others.

  24. I loved as much as you will receive carried out right
    here. The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get bought an impatience over that you wish be delivering the following.

    unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this hike.

  25. I’ve been exploring for a little for any high-quality articles
    or weblog posts in this kind of house . Exploring in Yahoo I finally stumbled upon this website.

    Studying this information So i am satisfied to express that I have an incredibly excellent uncanny
    feeling I discovered just what I needed. I such a lot indisputably will make
    certain to do not disregard this web site and provides
    it a look regularly.

  26. Wow that was unusual. I just wrote an really long comment but after I clicked submit
    my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say fantastic blog!

  27. Howdy! I could have sworn I’ve been to this blog before but after checking through some of the
    post I realized it’s new to me. Anyhow, I’m definitely glad I found
    it and I’ll be bookmarking and checking back often!

  28. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog
    that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and
    was hoping maybe you would have some experience
    with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *