VB Or Power Shell Test Exchange Email Functionality

Does anyone have a script to run as a job every so often to text if exchange is sending email out its queue?  We have a client with a large exchange environment and once in a while it stops working, our own internal exchange server could alert us, I know VB can send email directly to any server we choose, we have VPN tunnel connectivity to the other environment...

I tried to word it the best I could but would love some input and or questions.

Thanks!
LVL 1
smyers051972Asked:
Who is Participating?
 
Rich RumbleSecurity SamuraiCommented:
Is there possibly an event in the evt log that gets triggered when it dies? Does the exe/service itself stop? If the service stops or the exe does, you can create a trigger using vbscript to send an alert with a 3rd party email like google or some other SMTP server that is working. Well the script can do a lot of things really, and services have a extra method within themselves to try to restart themselves if they fail. The "recovery" tab has all sorts of actions you can take: http://technet.microsoft.com/en-us/library/cc753662.aspx
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'exchange.exe'")
If colProcesses.Count = 0 Then
    Wscript.Echo " Exchange.exe is not running."
Else
    Wscript.Echo " Exchange.exe is running."
End If

Open in new window

If you want to search for a specific Event code or item:
http://blogs.technet.com/b/heyscriptingguy/archive/2007/02/26/how-can-i-monitor-event-log-messages-for-specific-words.aspx
http://blogs.technet.com/b/heyscriptingguy/archive/2005/08/16/how-can-i-monitor-the-event-logs-for-the-occurrence-of-a-specific-event.aspx (how to loop)
-rich
0
 
Rich RumbleSecurity SamuraiCommented:
You can use VBScript, it requires that a user be logged in, and it will run as that user using outlook. http://support.microsoft.com/kb/161088
This one does not require outlook, and can use a 3rd party like gmail to send the email perhaps as another kind of test (receiving test).
http://cmanios.wordpress.com/2012/09/12/send-email-from-vbscript-using-smtp-and-gmail/
-rich
0
 
smyers051972Author Commented:
I had some time to think on this so here is our situation we have multiple domains, our own internal one we can call domainx.com and the clients exchange domainy.com we could use a script on our end to send us an email from the clients domain to us.... I am not sure what else from there.  I would prefer not using outlook if possible.
0
 
smyers051972Author Commented:
If not that way I am thinking need a way to test if Exchange SMTP is working, if its not email us a ticket to our support email...
0
 
kevinhsiehCommented:
I use a program called IPsentry to monitor my Exchange environment. Specifically it has the ability to send an email via SMTP and then check to via POP3 if it has been delivered. It can send out email and text alerts, and it has a ton of other functionality, and its very reasonably priced. If you want to check outgoing queues, you could relay a message from their server and then check for it on your server or any other mail provider that accepts POP3 access. You can also check the event logs, though I have no idea what to look for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.