Supportnet / Forum / Skripte(PHP,ASP,Perl...)
WSH / WMI Steuerung
Frage
Hi zusammen,
Ich bräuchte einen Tip, ich weiß das der unten aufgeführte Code nicht ganz richtig ist, aber ich wüsste auch nicht wie ich suchen soll.
Der erste Codeteil gibt mir den Status eines Services aus:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery _
("Select * from Win32_Service where Name=´HTTPFilter´")
For Each objService in colRunningServices
Wscript.Echo objService.DisplayName & VbTab & objService.State
Next
Der folgende Codeteil sendet mir eine Email, und darin soll das Eregebnis aus dem ersten Code (also ob der Service läuft oder nicht) enthalten sein.
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Reboot of Server"
objMessage.From = "reboot-master@anbieter.com"
objMessage.To = "matthias.orczak@anbieter.com"
objMessage.HTMLBody = "<p>This is a automatic generated email for the NOC to inform them
</p><p>that the second Umero Server (10.0.217.117) has rebooted
</p><p><strong>successfully</strong>.</p>"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.anbieter.com"
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send

