Home All Groups Group Topic Archive Search About

Alerts for Performance Counters



Author
14 Nov 2007 6:32 PM
Tomm
I have been searching every where to find some sample code (vbscript, VB.NET,
c#, VB) to create alerts in "Performance Logs and Alerts".  Does anyone have
any sample code to get me started?

Author
14 Nov 2007 7:59 PM
Joseph T Corey
The WMI classes for Performance Monitor alerting is pretty slim. To my
knowledge, the Sysmon class (which is under root\WMI) is limited to one
method and does not include a means to create new alerts.

However, this can be done using the logman command. You could do something
like this if you wanted to alert when the available memory is below 50MB:

logman.exe create alert new_alert -th "\Memory\Available MBytes<50"

There is much more info at
http://technet2.microsoft.com/windowsserver2008/en/library/93e6fc2b-5bf5-413b-84b4-be8b9dd3a57d1033.mspx?mfr=true.

If you need to wrap in VBScript for some reason, just use the Run method of
Wscript.Shell.

Hope this helps!

--
Joseph T. Corey  MCSE, Security+
Systems Administrator
jco***@cmu.edu



Show quote
"Tomm" <T***@discussions.microsoft.com> wrote in message
news:59AD73E2-AF91-45BB-A515-778EF49C431C@microsoft.com...
>I have been searching every where to find some sample code (vbscript,
>VB.NET,
> c#, VB) to create alerts in "Performance Logs and Alerts".  Does anyone
> have
> any sample code to get me started?
Author
14 Nov 2007 9:00 PM
Tomm
Joseph
It looks like anything less then Windows 2008 does not have the ability to
add alerts...bummer but I'm glad to hear that they addressed that issue.  I
think I found a way to create one by creating some registry keys.  I'm still
testing it on my Virtual Machine.  I'll post it when I completely tested it. 
Maybe I can create a program to versions less then Windows 2008.

Thanks so much for your help.

Show quote
"Joseph T Corey" wrote:

> The WMI classes for Performance Monitor alerting is pretty slim. To my
> knowledge, the Sysmon class (which is under root\WMI) is limited to one
> method and does not include a means to create new alerts.
>
> However, this can be done using the logman command. You could do something
> like this if you wanted to alert when the available memory is below 50MB:
>
> logman.exe create alert new_alert -th "\Memory\Available MBytes<50"
>
> There is much more info at
> http://technet2.microsoft.com/windowsserver2008/en/library/93e6fc2b-5bf5-413b-84b4-be8b9dd3a57d1033.mspx?mfr=true.
>
> If you need to wrap in VBScript for some reason, just use the Run method of
> Wscript.Shell.
>
> Hope this helps!
>
> --
> Joseph T. Corey  MCSE, Security+
> Systems Administrator
> jco***@cmu.edu
>
>
>
> "Tomm" <T***@discussions.microsoft.com> wrote in message
> news:59AD73E2-AF91-45BB-A515-778EF49C431C@microsoft.com...
> >I have been searching every where to find some sample code (vbscript,
> >VB.NET,
> > c#, VB) to create alerts in "Performance Logs and Alerts".  Does anyone
> > have
> > any sample code to get me started?
>

AddThis Social Bookmark Button