Would like to use vbscript to get WMI alert and not SQL Agent alerting process
-
Thursday, March 29, 2012 10:22 AM
Hello,
I'm trying to write a script to get the WMI mirroring messages.
Following my script:
strComputer = "WINSQL1"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\Microsoft\SqlServer\ServerEvents\INSTONE")
while 1=1
Wscript.Echo "------------"
Set colItems = objWMIService.ExecQuery("SELECT * from DATABASE_MIRRORING_STATE_CHANGE")
Wscript.Echo colItems.count
For Each objItem in colItems
Wscript.Echo "Contrôle"
Wscript.Echo "Database: " & objItem.DatabaseName
Wscript.Echo "StartTime: " & objItem.StartTime
Wscript.Echo "State: " & objItem.State
Wscript.Echo
Next
wendI have no error but I have any messages in the colItems.
Any idea ?
Thanks
All Replies
-
Friday, March 30, 2012 8:58 PMIs their any particular reason you are doing this thru VB?
http://uk.linkedin.com/in/ramjaddu
-
Saturday, March 31, 2012 12:32 PM
I have already implemented alerting using VBscript .please contact me on my email ID .
Prashant Deshpande

