Question
October 4, 2007 at 07:27 PM
bhnizam79

How do I send the VBScript Output to my Email?

by bhnizam79 . Updated 18 years, 8 months ago

I am using the below script to find out the status of the Windows Services in the Server. How can i send the output to my email instead of showing it on the desktop?

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
Set colServices = objWMIService. _
ExecNotificationQuery(“Select * from __InstanceModificationEvent ” _
& “within 30 where TargetInstance isa ‘Win32_Service'”)
i = 0
Do While i = 0
Set objService = colServices.NextEvent
If objService.TargetInstance.State <> _
objService.PreviousInstance.State Then
Wscript.Echo objService.TargetInstance.Name _
& ” is ” & objService.TargetInstance.State _
& “. The service previously was ” & objService.PreviousInstance.State & “.”
End If
Loop

This discussion is locked

All Comments