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

1.027 Comentários

  1. Você empregou de forma fácil a a escrita aqui. Eu sabor mas de site de forma.
    Assim a gente entende rápido o que o responsável quer expressar.

  2. как активировать ваучер в 1win [url=https://1win12019.ru/]как активировать ваучер в 1win[/url]

  3. Whats up are using WordPress for your blog platform?

    I’m new to the blog world but I’m trying to get started and set
    up my own. Do you require any coding expertise to make your own blog?
    Any help would be really appreciated!

  4. Hi to every body, it’s my first pay a visit of this blog; this website includes awesome and in fact
    good data in favor of readers.

  5. Pretty section of content. I simply stumbled upon your web site and in accession capital to say that I get actually loved account your weblog posts.

    Anyway I will be subscribing for your augment and even I fulfillment you
    get entry to consistently fast.

  6. I really love your blog.. Great colors & theme. Did you build this web site yourself?
    Please reply back as I’m wanting to create my very own blog and want to know
    where you got this from or exactly what the theme is called.
    Cheers!

  7. Valuable info. Fortunate me I discovered your web site by accident, and I am stunned
    why this accident didn’t took place earlier! I bookmarked it.

  8. Thanks a lot for sharing this with all people you actually recognize what you
    are speaking about! Bookmarked. Please also consult with
    my site =). We will have a hyperlink alternate agreement between us

  9. Hi I am so thrilled I found your site, I really found you by mistake, while I was browsing on Google for something else, Regardless I am here now and would just like to say thank
    you for a marvelous post and a all round thrilling blog (I also love
    the theme/design), I don’t have time to browse it all at the
    minute but I have saved it and also included your RSS
    feeds, so when I have time I will be back to read more, Please do keep up the fantastic job.

  10. sex sex

    Heya! I’m at work surfing around your blog from my new iphone 4!
    Just wanted to say I love reading your blog and look forward to all your
    posts! Keep up the outstanding work!

  11. hello there and thank you for your info – I’ve definitely picked up anything new from right here.
    I did however expertise some technical points using this site, since I experienced
    to reload the website a lot of times previous to I
    could get it to load correctly. I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will often affect your placement in google and can damage your high quality score if ads and marketing with Adwords.

    Well I’m adding this RSS to my e-mail and can look out for a lot more of your respective exciting
    content. Make sure you update this again soon.

  12. Mojado soplar selfies y primer plano boca aparecen en estos resbaladizo.
    XXX ducha tomas, que destacan desafiante vibraciones porno y son renombrados entre los
    espectadores abajo cachondos. Las galerías MILF película,
    que cuentan con cosmética garrillas, coito película selfies, y filtraciones de pajas XXX,
    hacen que todos los cachonda suscriptores ridículo, haciendo
    que los chicos de todo el mundo se masturben sin saltarse sus filtraciones.
    Primeros planos en alta definición y audio envolventes. se aparecerán en el próximo OnlyFans contenido,
    junto con peligroso fotografías de upskirts y puñetazo trabajos
    en el coche. Nada la excita más que el goteo de porno misionero sin censura,
    que se envuelve alrededor de él en la misión de fugas XXX y fotos de sexo
    en bruto donde el coño sigue abierto y las tetas apretar
    duro. https://es.she-international.com/bombom/

  13. Thanks in favor of sharing such a pleasant opinion, article is fastidious, thats why i
    have read it fully

  14. This design is spectacular! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start
    my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it.
    Too cool!

  15. Howdy excellent website! Does running a blog similar to this take
    a great deal of work? I’ve very little knowledge of coding however I was hoping to
    start my own blog in the near future. Anyway, if you have any suggestions or
    techniques for new blog owners please share. I understand this
    is off topic but I just had to ask. Many thanks!

  16. Hi! Do you know if they make any plugins to protect against
    hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

  17. Amazing! This blog looks just like my old one! It’s on a totally different subject but it has pretty much the same layout and design. Great choice of
    colors!

Deixe um comentário

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