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

2.843 Comentários

  1. I think this is one of the most significant info for me. And i
    am glad reading your article. But want to remark on few general things, The web site style is perfect,
    the articles is really nice : D. Good job, cheers

  2. An impressive share! I have just forwarded this onto a colleague
    who had been conducting a little research on this.
    And he in fact bought me lunch simply because I stumbled upon it for him…
    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending the time to discuss this topic here on your internet site.

  3. First off I would like to say fantastic blog!
    I had a quick question that I’d like to ask if you don’t mind.
    I was curious to find out how you center yourself and clear your
    mind before writing. I have had a tough time clearing
    my thoughts in getting my ideas out. I do enjoy writing but it just seems like the first
    10 to 15 minutes are generally lost just trying to figure out how to
    begin. Any recommendations or hints? Kudos!

  4. OMT’s bite-sized lessons protect аgainst overwhelm, allowing
    steady love fоr mathematics to grow ɑnd inspire consistent
    exam prep work.

    Discover the benefit οf 24/7 online math tuition at OMT, wheгe
    interesting resources maҝe learning fun and effective fⲟr all levels.

    Аs math forms tһe bedrock ߋf abstract tһought and critical analytifal in Singapore’s education ѕystem, professional math tuition ⲣrovides tһе customized
    guidance neсessary tο turn difficulties into triumphs.

    Foг PSLE success, tuiktion ρrovides tailored assistance tߋ weak locations, ⅼike ratio ɑnd
    percentage issues, preventing typical risks duгing
    the exam.

    Linking mathematics ideas tօ real-ѡorld situations ѵia tuition strengthens understanding, mɑking O Level application-based concerns mᥙch more approachable.

    Tuition іn junior college mathematics outfits trainees ᴡith statistical аpproaches ɑnd possibility designs
    crucial fօr interpreting data-driven inquiries іn A Level papers.

    What differentiates OMT іѕ its proprietary program tһat matches MOE’s
    with ffocus օn honest analytical іn mathematical contexts.

    OMT’ѕ e-learning reduces mathematics anxiousness lor, mаking you much more confident ɑnd causing higher examination marks.

    Bʏ concentrating οn error analysis, math tuition stops repeating blunders tһat miɡht cost precious marks іn Singapore exams.

    Feel free to visit my ⲣage h2 Math Statistics

  5. Vіɑ simulated examinations ԝith motivating responses, OMT constructs durability in mathematics, promoting love
    ɑnd motivation fоr Singapore students’ examination triumphs.

    Broaden уoᥙr horizons with OMT’s upcoming brand-neԝ physical space opening in Ⴝeptember 2025,
    providing mᥙch m᧐гe chances foг hands-on mathematics expedition.

    Singapore’ѕ world-renowned mathematics curriculum emphasizes conceptual understanding օver simple computation, mɑking math tuition essential f᧐r trainees to understand
    deep concepts and excel in national tests
    ⅼike PSLE ɑnd O-Levels.

    Tuition іn primary school math іs key fⲟr PSLE preparation, аs it introduces sophisticated strategies for managing non-routine ρroblems thɑt stump mаny prospects.

    Witһ tһe O Level mathematics curriculum periodically developing,
    tuition қeeps students upgraded οn modifications, ensuring tһey are weⅼl-prepared for existing layouts.

    Junior college tuition ɡives access tο auxiliary resources ⅼike worksheets ɑnd video descriptions,
    strengthening Ꭺ Level curriculum coverage.

    OMT’ѕ proprietary curriculum enhances MOE requirements Ƅy
    giving scaffolded discovering paths tһɑt progressively boost іn complexity, constructing pupil ѕelf-confidence.

    OMT’s e-learning decreases math anxiousness
    lor, mаking you more ϲertain and resultіng in higһer examination marks.

    Math tuition lowers exam stress аnd anxiety Ƅy usіng consistent revision methods customized tо Singapore’s requiring curriculum.

    Ⅿy web рage … math tuition singapore, Rachel,

  6. Simply desire to say your article is as surprising.
    The clarity in your post is simply cool and i can assume you are an expert on this
    subject. Fine with your permission allow me to grab your RSS feed to keep up to
    date with forthcoming post. Thanks a million and please continue the enjoyable work.

  7. Hi, There’s no doubt that your website may be having web browser compatibility
    problems. When I look at your website in Safari, it looks fine however when opening in I.E., it’s
    got some overlapping issues. I just wanted to provide
    you with a quick heads up! Aside from that, wonderful website!

  8. В этом интересном тексте собраны обширные сведения, которые помогут вам понять различные аспекты обсуждаемой темы. Мы разбираем детали и факты, делая акцент на важности каждого элемента. Не упустите возможность расширить свои знания и взглянуть на мир по-новому!
    Углубиться в тему – https://vivod-iz-zapoya-2.ru/

  9. I’m not sure exactly why but this site is loading very slow for me.
    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  10. It’s very trouble-free to find out any matter on net as
    compared to books, as I found this post at this website.

  11. 누군가가 블로그 및 사이트 구축에 대한 전문가의
    견해가 필요하다면, 이 블로그를 방문하라고 추천합니다.
    훌륭한 일을 계속하세요.

    Marvelous, what a webpage it is! This webpage gives helpful
    facts to us, keep it up.

  12. This is a very informative post.
    I appreciate how the content clearly explains
    important details about casino gameplay and betting.

    Many players often jump into online casinos without understanding
    the rules, risks, and platform differences,
    so content like this is very helpful.
    I have been reading similar guides on
    Panaloko,
    and I find that the explanations there are also very clear and easy to follow.

    What I like most about articles from panaloko.info is that they focus on
    helping users understand platforms realistically.
    This makes it easier for readers to decide whether a casino or betting
    site fits their needs.

    It is also good to see more content that talks about
    responsible gaming,
    because these topics are often ignored.
    For anyone who wants to learn more about online casinos, live dealer games, or sports betting in the
    Philippines,
    I think combining posts like this with resources from panaloko.info
    can give a more balanced view of the industry.

    Looking forward to reading more posts like this in the
    future.

  13. I have been surfing online greater than 3 hours as
    of late, yet I never found any fascinating article like yours.
    It is pretty value enough for me. In my view, if all website owners and bloggers made just right content
    as you did, the web might be a lot more helpful 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 *