Solved

VBS Backup Message Notification

Posted on 2009-07-01
3
348 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 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