Set WshShell = CreateObject("WScript.Shell")
' lokalen Computer auswählen
' alles andere ist gemein
strComputer = "."
intWartezeitVorStutdown = 30 ' Sekunden
intAntwort = 0
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where " & _
"Name = 'dvwin32.exe' OR " & _
"Name = 'notepad.exe' OR " & _
"Name = 'cinergydvr.exe' OR " & _
"Name = 'notepad++.exe' OR " & _
"Name = 'firefox.exe' OR " & _
"Name = 'eve.exe' OR " & _
"Name = 'CMR5.EXE' OR " & _
"Name = 'PVAStrumento.exe' OR " & _
"Name = 'Cuttermaran.exe' OR " & _
"Name = 'ImagoMPEG-Muxer.exe' OR " & _
"Name = 'Lame.exe' OR " & _
"Name = 'Virtua~1.exe' OR " & _
"Name = 'DGIndex.exe' OR " & _
"Name = 'DVD Shrink 3.2.exe' OR " & _
"Name = 'VOBMerge.exe' OR " & _
"Name = 'NeroStartSmart.exe' OR " & _
"Name = 'df.exe' OR " & _
"Name = 'openttd.exe' OR " & _
"Name = 'vlc.exe' OR " & _
"Name = 'InstTool.exe' OR " & _
"Name = 'elevate.exe' OR " & _
"Name = 'dvdflick.exe' OR " & _
"Name = 'mediacoder.exe' OR " & _
"Name = 'avsinput.exe' OR " & _
"Name = 'xbmc.exe' OR " & _
"Name = 'wmplayer.exe' OR " & _
"Name = 'iexplore.exe' OR " & _
"Name = 'nero.exe'")
For Each objProcess in colProcesses
intAntwort = intAntwort + 1
Next
If intAntwort > 0 Then
intType = 64 + 2
' If intAntwort > 1 Then
' intButton = WshShell.Popup ("Es laufen noch " & intAntwort & " registrierte Prozesse.", 5, "Prozessüberwachung", intType)
' else
' intButton = WshShell.Popup ("Es läuft noch ein registrierter Prozess.", 5, "Prozessüberwachung", intType)
' end if
select case intButton
case -1
' Keine Taste gedrückt
Wscript.Quit
case 1
' OK
Wscript.Quit
case 2
' Cancel
Wscript.Quit
case 3
' Abbrechen
Wscript.Quit
case 4
' Wiederholen
Wscript.Quit
case 5
' Ignorieren
Wscript.Quit
case 6
'ja
Wscript.Quit
case 7
' nein
Wscript.Quit
end select
Wscript.Quit
else
intType = 48 + 1
wshShell.RUN "c:\skripte\sendmail.exe /t:eMail c:\skripte\Mail-Ruhezustand.txt /to:cwieners@peter-wieners.de /from:info@carsten-wieners.de /s:""Rechner startet neu"""
intButton = WshShell.Popup ("Keine laufenden Prozesse mehr gefunden, der Rechner wird nun neu gestartet", intWartezeitVorStutdown, "", intType)
select case intButton
case -1
' Keine Taste gedrückt
wshShell.RUN "c:\skripte\Neustart.cmd"
Wscript.Quit
case 1
' OK
wshShell.RUN "c:\skripte\Neustart.cmd"
Wscript.Quit
case 2
' Cancel
Wscript.Quit
case 3
' Abbrechen
Wscript.Quit
case 4
' Wiederholen
Wscript.Quit
case 5
' Ignorieren
Wscript.Quit
case 6
'ja
wshShell.RUN "c:\skripte\Neustart.cmd"
Wscript.Quit
case 7
' nein
Wscript.Quit
end select
End If
Wscript.Quit