Skip to content

Verify if a process is executing and notificate via e-mail on Windows

Hello,

A few days ago my friend need a Visual Basic Script to verify if a process is running and if it is send an e-mail. He asked me for help to code it, and I helped him.

Visual Basic Script to verify if a process is running and notify via e-mail.

Verify if a process is running with Visual Basic Script and shows a window if it is.
[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]

Send an e-mail using Visual Basic Script
[code lang=”vb”]
Const username = “USERNAME”
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]

This two scripts are changed to work together to do what we want and have a config section.

Best Regards,
Matheus

References:
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

Published inwindows

641 Comments

  1. Hello there! I could have sworn I’ve been to this website before but
    after browsing through many of the posts I realized it’s new to me.
    Anyways, I’m certainly happy I discovered it and I’ll be bookmarking it and checking back regularly!

  2. Paragraph writing is also a fun, if you be acquainted with then you can write otherwise it is difficult
    to write.

  3. whoah this blog is wonderful i like reading your posts.
    Keep up the good work! You recognize, lots of persons are looking around for this info, you can help them greatly.

  4. OMT’s interactive quizzes gamify knowing, mаking mathematics hahit forming fοr Singapore pupils and inspiring tһem to promote impressive examination qualities.

    Discover tһe convenience օf 24/7 online math tuition аt
    OMT, where engaging resources make learning fun and effective fօr aⅼl levels.

    Τhe holistic Singapore Math method, ᴡhich develops multilayered analytical abilities, underscores ԝhy math tuition іs essential for mastering tһe curriculum аnd
    getting ready for future careers.

    Through math tuition, students practice PSLE-style questions սsually аnd graphs,
    enhancing precision аnd speed սnder test conditions.

    Βу supplying comprehensive experiment рrevious Ο Level documents, tuition equips trainees ᴡith familiarity ɑnd tһе capability tօ prepare foг
    question patterns.

    Junior college tuition рrovides access to
    extra sources like worksheets аnd video explanations, strengthening A Level curriculum coverage.

    OMT’ѕ custom-madе curriculum distinctively enhances the MOE framework
    by providing thematic units tһat attach mathematics topics
    throughout primary tօ JC levels.

    Multi-device compatibility leh, ѕ᧐ switch oѵer from
    laptop computer to phone ɑnd keep improving thosе qualities.

    Ӏn Singapore’ѕ affordable education landscape, math tuition ߋffers tһe additional sidе needed for students to succeed in hiɡh-stakes exams ⅼike the PSLE,O-Levels, and A-Levels.

    Check օut my web page aspire hub math tutor jobstreet –
    Janna,

  5. Heya i’m for the first time here. I came across this board and I find It truly
    useful & it helped me out a lot. I hope to give something back and help
    others like you aided me.

  6. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your weblog?
    My blog is in the very same niche as yours and my visitors would certainly benefit from some of the information you present
    here. Please let me know if this okay with you. Thanks!

  7. I’ll immediately seize your rss as I can not find your email subscription link or newsletter service.
    Do you’ve any? Kindly permit me realize in order that I may just subscribe.
    Thanks.

  8. May I just say what a relief to uncover a person that genuinely knows what they are discussing over the internet.
    You definitely know how to bring a problem to light and make it important.
    A lot more people should look at this and understand this side of your story.
    I can’t believe you are not more popular because you definitely possess the gift.

  9. Hey there! This is my first visit to your blog! We are a
    collection of volunteers and starting a new
    project in a community in the same niche. Your blog provided us useful information to work on. You have done a outstanding job!

  10. โพสต์นี้ มีประโยชน์มาก ครับ
    ผม ไปเจอรายละเอียดของ
    ข้อมูลเพิ่มเติม
    สามารถอ่านได้ที่ Lonna
    น่าจะถูกใจใครหลายคน
    เพราะอธิบายไว้ละเอียด
    ขอบคุณที่แชร์ ข้อมูลที่มีประโยชน์ นี้
    และอยากเห็นบทความดีๆ แบบนี้อีก

  11. May I simply say what a relief to discover an individual who genuinely
    knows what they’re talking about on the internet.
    You actually know how to bring an issue to light and make
    it important. More people have to check this out and understand this side of your story.
    I can’t believe you’re not more popular because you definitely possess the gift.

  12. Every weekend i used to pay a visit this website, because i wish
    for enjoyment, for the reason that this this web site conations genuinely fastidious funny information too.

  13. บทความนี้ น่าสนใจดี ครับ
    ดิฉัน ได้อ่านบทความที่เกี่ยวข้องกับ ข้อมูลเพิ่มเติม
    ดูต่อได้ที่ betfliknew
    น่าจะถูกใจใครหลายคน
    เพราะอธิบายไว้ละเอียด
    ขอบคุณที่แชร์ บทความคุณภาพ นี้
    และหวังว่าจะมีข้อมูลใหม่ๆ มาแบ่งปันอีก

  14. I was recommended this web site by my cousin. I am not sure whether this post is
    written by him as no one else know such detailed
    about my trouble. You’re wonderful! Thanks!

  15. sex sex

    Hi there, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam responses?
    If so how do you reduce it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any assistance is very much appreciated.

  16. I used to be suggested this web site via my cousin. I’m no longer certain whether
    this post is written by him as no one else realize such targeted approximately my difficulty.

    You are wonderful! Thanks! https://offerwall.admitad.com/wall/offers/?w=2815536&c=35929&r=3&d=3&g=NL&x=259d76c08a24c71cb571db6f2e12beb4&y=8925d110a6b4fa56862b7c0284091f86

  17. Your style is unique in comparison to other people I’ve read stuff from.
    I appreciate you for posting when you’ve got the
    opportunity, Guess I’ll just bookmark this page.

  18. Nice post. I was checking continuously this blog and I’m impressed!
    Very helpful info specially the last part 🙂 I care for such information much.

    I was seeking this particular info for a very long time.
    Thank you and good luck.

  19. I’m amazed, I must say. Seldom do I encounter a blog that’s both educative and interesting,
    and let me tell you, you’ve hit the nail on the head.
    The problem is something not enough people are speaking intelligently
    about. Now i’m very happy I stumbled across this during my search for something concerning this.

Leave a Reply

Your email address will not be published. Required fields are marked *