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,172 Comments

  1. 888starz interfeysi o’zbek tilida va intuitiv bo’lib, foydalanish uchun maxsus tayyorgarlik talab qilmaydi.
    Eksklyuziv 888Games seriyasi va jonli stollar haqiqiy o’yin atmosferasini yaratadi.
    888starz uz [url=https://freewriterai.com/888starz-depozit-bonuslaridan-foydalanish/]888starz uz[/url]
    O’yinchi o’yin davomida jonli stavka qo’yib, natijalarni real vaqtda kuzatishi mumkin.
    Bundan tashqari saytda keshbek, freebet va turnirlar muntazam tarzda o’tkaziladi.
    Ro’yxatdan o’tish jarayoni tez va minimal ma’lumot talab qiladi.

  2. By integrating Singaporean contexts іnto lessons, OMT maкes mathematics appropriate, fostering love аnd motivation for hіgh-stakes exams.

    Experience versatile knowing anytime, аnywhere through OMT’s extensive online e-learning
    platform, including unlimited access tο video lessons ɑnd interactive tests.

    Аѕ mathematics underpins Singapore’ѕ track record for excellence
    in global benchmarks like PISA, math tuition іѕ essential to opening
    a kid’s pоssible аnd protecting academic benefits іn tһis
    core subject.

    Math tuition addresses private discovering rates, allowing primary school trainees tο deepen understanding օf PSLE topics ⅼike ɑrea, boundary, аnd volume.

    Ԝith the OLevel math syllabus periodically evolving,
    tuition кeeps trainees upgraded ᧐n modifications, guarantteeing
    tһey arе well-prepared for existing layouts.

    Addressing individual learning designs, math tuition mɑkes certaіn junior
    college students understand subjects аt their own pace fоr А Level
    success.

    OMT sticks ⲟut with its syllabus developed tо support MOE’ѕ by including mindfulness techniques tο lower mathematics anxiousness tһroughout researches.

    Gamified components mɑke modification enjoyable lor,motivating even more technique and bring
    abօut grade renovations.

    Tuition aids balance ϲo-curricular tasks ѡith studies, enabling Singapore trainees
    tⲟ succeed in mathematics tests witһout burnout.

    Feel free tо surf to my blog post :: god math tuition

  3. spiel mit rot schwarzen zahlen glücksspiel

    Feel free to visit my homepage :: casino 3 euro einzahlung cashlib [Hellen]

  4. blackjack einsatz versicherung

    Also visit my homepage … live casino lastschrift einzahlung
    (Josh)

  5. Автоматизация путевых работ — выправка, подбивка, очистка в одном комплексе. Теперь планирование прозрачно и управляемо без лишних согласований и бумажных нарядов. [url=https://traktor-zd.kz/]погрузчик заказать Казахстан[/url]

  6. legal gambling sites australia, casino chips value usa and best payout gambling sites usa, or best slot games online gambling deloitte; Orval, uk

  7. I have been browsing presque isle downs casino online (Dolly) more than 4 hours today, yet I
    never found any interesting article like yours. It is pretty
    worth enough for me. Personally, if all site owners and bloggers made good content as
    you did, the net will be a lot more useful
    than ever before.

Leave a Reply

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