We help IT Professionals succeed at work.

perfmon will not execute a vbs script which in turn sends an email alert

Last Modified: 2013-12-01
I have wrote a simple vbs script that sends an email whenh executed. This script works, so the problem is not with the script.
I am checking logicaldisk within perfmon, and set a test threshold so that it alerts me via the vbs email script.
Alas, the script never runs.
I have even tried changing it to a bat and cmd file by adding the cscript (the script works when executed manually).
I have tried running perfmon on Windows 2000 Server, and also Windows 2003 Server (I added a domain admin user to run the script), but the script never initializes
Is it possible to do this?
I googled this and found someone else with the exact same problem here:

Watch Question

Top Expert 2007

Can you wrap the vbs processing in a batch file and dump out some debugging information in the batch file to verify that the processing is being executed and also capture any errors generated from the vbs processing. Something like this. Also, you've only assigned 50 points for the question. You'll get better responses by awarding a more suitable value to the question. In this case I'd recommend 250 or 500.
@echo off
set outFile=c:\temp\temp.log
echo In %~0 %date% %time%>>"%outFile%"
cscript c:\yourdir\script.vbs >>"%outFile%" 2>&1 

Open in new window

Top Expert 2014

Do you see any errors in any of the event logs?

What user-id are you attempting to execute the script under?  Does this user-id have execute authority for your script file?

If you create a batch file that does something like:

echo STARTED > c:\log1.txt
cscript c:\pathtoscript\script.vbs or just plain c:\pathtoscript\script.vsb
echo ENDED >> c:\log1.txt

Do you get anything in log1.txt?
Jeffrey Kane - TechSoEasyPrincipal Consultant
Most Valuable Expert 2016
Top Expert 2014

While I'm not very versed in this stuff... it's my understanding that in order to receive an email alert for a performance monitor alert, the alert needs to create an entry in the event log, and the email is sent due to the event log entry being created.  This process uses the eventtriggers command.

If your alert is not already creating the event, see this KB for how to get it to do that:  http://support.microsoft.com/kb/184747

Then, in order to send an email from an event, you need to create a script as follows (my example is for Event ID 1016):

Save the following script in C:\batch with the name 1016.vbs

'begin code
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Drive Space"
objMessage.From = "administrator@domain.com"
objMessage.To = "someaddress@domain.com"
objMessage.TextBody = "Drive Space Warning"
'end code

Change the addresses in 1016.vbs to match your domain (leave the administrator but change the domain name in the objMessage.From), and the real address where you want the email to be sent (objMessage.To).

Test the script to make sure that it sends the email for you.

Finally, you must use the eventtriggers command to create the trigger:

Enter the following at a Command Prompt:

eventtriggers /create /tr DriveSpaceWarn /eid 1016 /t INFORMATION /tk "c:\batch\1016.vbs" /ru "System"

More info on eventtriggers:  http://technet2.microsoft.com/windowsserver/en/library/e33bcf4c-dece-4b47-9bb7-31ecfcbc76d51033.mspx?mfr=true


This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.