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

8,114 Comments

  1. DonaldMaf DonaldMaf

    Публикация охватывает основные направления развития современной медицины. Мы обсудим значимость научных исследований, инноваций в лечении и роли общественного участия в формировании системы здравоохранения.
    Это стоит прочитать полностью – [url=https://rebiza.ru/detoksikatsiya-posle-dlitelnogo-upotrebleniya-meditsinskaya-pomoshh-i-riski/]капельница от алкоголя на дому[/url]

  2. las vegas usa download casino java games (Jeannie) reviews,
    first casino in united states and can us citizens play online poker in united states, or poker bonus uk

  3. Hal Hal

    play roulette online gambling raid in malaysia; Hal, canada free, free
    real online pokies united states and grand mondial casino australia, or new zealandn poker table

  4. is why gambling is not good – Stephaine, allowed in united states, casimba
    casino nz login and is top online pokies and casinos in australia same,
    or minimum deposit 1 pound casino usa

  5. slots no wagering uk, top online pokies and casinos canadian update
    and free united statesn poker money, or slot machine hire usa

    my site – crypto wheels casino (Albertha)

  6. I’m Anna, a 35-year-old woman. For years, my marriage was
    falling apart. We argued constantly. Eventually, I accepted that our
    marriage had reached its end.

    One evening, while relaxing after a stressful
    day, I discovered an online slot. The game featured glowing
    reels, exciting bonus features, and fast-paced action.
    Every spin felt exciting.

    At first, I played carefully. The reels showed colorful icons and bonus signs.
    Then something changed. A series of matching symbols appeared across the screen. The
    sounds became louder, the animations brighter, and my heart started racing.

    I could hardly believe my eyes. One bonus round led to another.
    Multipliers stacked. The winnings kept growing. My hands were shaking.
    The number on the screen climbed higher and higher.

    Then came the moment I will never forget. The reels aligned perfectly.

    The screen exploded with victory graphics. The total reached
    $100,000.

    I sat in complete shock. For several minutes, I simply stared at the screen.
    The emotions were overwhelming: pure excitement and gratitude.

    That win did not magically solve every problem in my life, but it gave me a fresh start.

    Around the same time, I met a kind person. More importantly, I realized that happiness comes from healthy
    relationships.

    Today, I look back on that night as a turning point.
    The future opened new doors. And while the jackpot was exciting, the biggest reward was finding the courage to create a life
    that felt right for me.

  7. Кстати, если вас интересует Новости и обновления от СКА медиа, загляните сюда.

    Вот, делюсь ссылкой:

    [url=https://ska-media.ru]https://ska-media.ru[/url]

  8. Hello! Would you mind if I share your blog with
    my facebook group? There’s a lot of folks that I think would really appreciate your content.
    Please let me know. Thanks

  9. Нужна бесплатная юридическая консультация? Переходите по запросу [url=https://vk.com/yurist.avsyunino]горячая линия бесплатной юридической консультации в Авсюнино[/url] и получите помощь опытных правозащитников в любой области права: семейные споры, долги и кредиты, недвижимость, трудовые конфликты, защита прав потребителей и многое другое. Задайте вопрос онлайн или по телефону и получите подробный разбор вашей ситуации и рекомендации адвоката по дальнейшим действиям. Консультация проводится бесплатно и конфиденциально.

  10. It’s the best time to make some plans for the future and it is
    time to be happy. I have read this post and if I could I want to suggest you some interesting things
    or suggestions. Perhaps you can write next articles
    referring to this article. I wish to read more things about
    it!

  11. You’ve made some decent points there. I looked on the net for additional information about
    the issue and found most individuals will go along with your views on this website.

Leave a Reply

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