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

13.697 Comentários

  1. hi!,I really like your writing very much! percentage we be in contact extra approximately your article on AOL?
    I require an expert in this house to unravel my problem. Maybe that’s you!
    Looking ahead to peer you.

  2. inventing a new casino table game (Joshua) zealandn online casino
    5 dollar min deposit, bitcoin gambling united kingdom and mobile poker sites usa, or does united kingdom have casinos

  3. DevinBig DevinBig

    Ниже — «скелет» визита. На месте врач адаптирует содержание под возраст, соматику, текущие лекарства и проявления абстиненции. Главная идея — быстро получить цифры, аккуратно запустить инфузию и заранее зафиксировать ориентиры, чтобы семья не импровизировала в «трудный час».
    Подробнее тут – [url=https://vyvod-iz-zapoya-stavropol15.ru/]вывод из запоя вызов на дом[/url]

  4. fortune_uzet fortune_uzet

    I have been using this casino for about four months now, so I have enough sessions behind me to judge. A friend from another forum pointed me at it, because I wanted somewhere that actually pays out on time. The game library at True Fortune is genuinely big, although in practice I stick to a dozen or so.

    Software comes from the usual names: Pragmatic Play, NetEnt, Play’n GO, plus some Red Tiger and Nolimit City. The obvious hits are all present, though personally I prefer the higher volatility stuff. Live casino runs on Evolution, which means the usual roulette and game-show line-up. Tables are staffed day and night, although the ?1 tables can be crowded after nine.

    The starting package is fairly standard: a first deposit match with a batch of free spins, released in daily portions. Wagering sits at 35x, so nothing predatory but no gift either. Current codes and whatever promo is running are worth checking on [url=https://ashyleighdesigns.com]true fortune casino[/url] since these change month to month. They run the odd free bonus too, although you will not retire on it.

    Opening an account took a few minutes, the deposit floor is around ?10. Visa, Mastercard and the usual wallets are accepted, Bitcoin is an option as well. Cashouts to Skrill took under a day, card payouts took two or three working days. KYC was the one sticking point – my first upload got rejected, but the second attempt cleared the same evening.

    Mobile is browser based for me so no install needed. Pages load fast, though live tables need decent data. Live chat replies in English and they are not just copy-pasting, wait times were three to five minutes. Licence is Curacao which is not the UK regulator, so play accordingly. Bottom line, cashouts have been honoured so far.

  5. CharlesLag CharlesLag

    В этой статье мы обсудим процесс восстановления после зависимостей, акцентируя внимание на различных методах и подходах к реабилитации. Читатели узнают, как создать план выздоровления и использовать полезные ресурсы для достижения устойчивых изменений.
    Проследить причинно-следственные связи – [url=https://romania-today.ru/news/different/2024/12/19/CHastnaya-narkologicheskaya-klinika-sovremennyy-podhod-k-lecheniyu-zavisimostey]нарколог вывод из запоя[/url]

  6. chicken road mastercard [url=https://geoconf.org/monte-carlo-simulation-in-infrastructure-risk-assessment-reading-the-distributio/]https://geoconf.org/monte-carlo-simulation-in-infrastructure-risk-assessment-reading-the-distributio/[/url]

  7. «Как отмечает врач-нарколог Алексей Николаевич Прудников, «выезд нарколога на дом — это возможность стабилизировать состояние пациента в привычной обстановке, снизив стресс и риски осложнений».»
    Углубиться в тему – [url=https://narkolog-na-dom-v-krasnodare14.ru/]нарколог на дом круглосуточно цены краснодар[/url]

  8. Georgevof Georgevof

    Лечение на дому подходит пациентам со стабильными показателями, если отсутствуют признаки тяжелого осложнения. Выезжаем по Москве и согласованным направлениям Московской области. Нарколог приезжает домой с набором препаратов и средствами для первичного контроля. Лечение дома позволяет не ехать в клинику, сохранить привычную обстановку и начать вывод из запоя в удобное время.
    Получить больше информации – [url=https://vyvod-iz-zapoya-moskva15-2.ru/]www.vyvod-iz-zapoya-moskva15-2.ru[/url]

Deixe um comentário

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