Solved

VBS Backup Message Notification

Posted on 2009-07-01
3
350 Views
Last Modified: 2013-12-20
I have a Backup script written in VBS that we want to give to one of our employees in Payroll to run whenever he needs it done. In order to monitor it on our end we want it to send a message to our Network Admin either through a command prompt or an email whenever it is run.

I myself am not very familiar with VB, the code we are using is open source and I just changed a few things to fit with our needs.

If anyone has any ideas as to what I should try out I'd greatly appreciate it.
0
Comment
Question by:TechsupportAbility
  • 2
3 Comments
 
LVL 3

Expert Comment

by:astroviper
ID: 24760194
Could send an email if you have a mail server on your network that supports it.

Set objMessage = CreateObject("CDO.Message")
objMessage.MimeFormatted = True
objMessage.From = "Mr. Someone <anyuser@wherever.com>" 
objMessage.To = "destination@there.com
objMessage.Subject = "subject here"
objMessage.HTMLBody = "body html here"
 
 
'==This section provides the configuration information for the remote
'== SMTP server. Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver ip"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
 
objMessage.Send

Open in new window

0
 
LVL 3

Accepted Solution

by:
astroviper earned 500 total points
ID: 24760204
I missed a double quote on the end of line 4. Could also use net send if your on xp.

Name = "net send {name | * | /DOMAIN[:name] | /USERS} message"
Set objShell = CreateObject("WScript.Shell")
Return = objShell.Run(Name, 1, true)

Open in new window

0
 

Author Closing Comment

by:TechsupportAbility
ID: 31598808
This worked perfectly. Thank you very much for you help!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question