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

8.172 Comentários

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

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

  5. 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.

Deixe um comentário

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