Rechner neustarten

Rechner neustarten, wenn nichts mehr läuft



  1. Set WshShell = CreateObject("WScript.Shell")
  2.  
  3. ' lokalen Computer auswählen
  4. ' alles andere ist gemein
  5. strComputer = "."
  6.  
  7. intWartezeitVorStutdown = 30 ' Sekunden
  8.  
  9. intAntwort = 0
  10.  
  11. Set objWMIService = GetObject("winmgmts:" _
  12. & "{impersonationLevel=impersonate}!\\" _
  13. & strComputer & "\root\cimv2")
  14.  
  15. Set colProcesses = objWMIService.ExecQuery _
  16. ("Select * from Win32_Process Where " & _
  17. "Name = 'dvwin32.exe' OR " & _
  18. "Name = 'notepad.exe' OR " & _
  19. "Name = 'cinergydvr.exe' OR " & _
  20. "Name = 'notepad++.exe' OR " & _
  21. "Name = 'firefox.exe' OR " & _
  22. "Name = 'eve.exe' OR " & _
  23. "Name = 'CMR5.EXE' OR " & _
  24. "Name = 'PVAStrumento.exe' OR " & _
  25. "Name = 'Cuttermaran.exe' OR " & _
  26. "Name = 'ImagoMPEG-Muxer.exe' OR " & _
  27. "Name = 'Lame.exe' OR " & _
  28. "Name = 'Virtua~1.exe' OR " & _
  29. "Name = 'DGIndex.exe' OR " & _
  30. "Name = 'DVD Shrink 3.2.exe' OR " & _
  31. "Name = 'VOBMerge.exe' OR " & _
  32. "Name = 'NeroStartSmart.exe' OR " & _
  33. "Name = 'df.exe' OR " & _
  34. "Name = 'openttd.exe' OR " & _
  35. "Name = 'vlc.exe' OR " & _
  36. "Name = 'InstTool.exe' OR " & _
  37. "Name = 'elevate.exe' OR " & _
  38. "Name = 'dvdflick.exe' OR " & _
  39. "Name = 'mediacoder.exe' OR " & _
  40. "Name = 'avsinput.exe' OR " & _
  41. "Name = 'xbmc.exe' OR " & _
  42. "Name = 'wmplayer.exe' OR " & _
  43. "Name = 'iexplore.exe' OR " & _
  44. "Name = 'nero.exe'")
  45.  
  46. For Each objProcess in colProcesses
  47. intAntwort = intAntwort + 1
  48. Next
  49.  
  50. If intAntwort > 0 Then
  51. intType = 64 + 2
  52. ' If intAntwort > 1 Then
  53. ' intButton = WshShell.Popup ("Es laufen noch " & intAntwort & " registrierte Prozesse.", 5, "Prozessüberwachung", intType)
  54. ' else
  55. ' intButton = WshShell.Popup ("Es läuft noch ein registrierter Prozess.", 5, "Prozessüberwachung", intType)
  56. ' end if
  57.  
  58. select case intButton
  59. case -1
  60. ' Keine Taste gedrückt
  61. Wscript.Quit
  62. case 1
  63. ' OK
  64. Wscript.Quit
  65. case 2
  66. ' Cancel
  67. Wscript.Quit
  68. case 3
  69. ' Abbrechen
  70. Wscript.Quit
  71. case 4
  72. ' Wiederholen
  73. Wscript.Quit
  74. case 5
  75. ' Ignorieren
  76. Wscript.Quit
  77. case 6
  78. 'ja
  79. Wscript.Quit
  80. case 7
  81. ' nein
  82. Wscript.Quit
  83. end select
  84. Wscript.Quit
  85. else
  86. intType = 48 + 1
  87.  
  88. 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"""
  89.  
  90. intButton = WshShell.Popup ("Keine laufenden Prozesse mehr gefunden, der Rechner wird nun neu gestartet", intWartezeitVorStutdown, "", intType)
  91. select case intButton
  92. case -1
  93. ' Keine Taste gedrückt
  94. wshShell.RUN "c:\skripte\Neustart.cmd"
  95. Wscript.Quit
  96. case 1
  97. ' OK
  98. wshShell.RUN "c:\skripte\Neustart.cmd"
  99. Wscript.Quit
  100. case 2
  101. ' Cancel
  102. Wscript.Quit
  103. case 3
  104. ' Abbrechen
  105. Wscript.Quit
  106. case 4
  107. ' Wiederholen
  108. Wscript.Quit
  109. case 5
  110. ' Ignorieren
  111. Wscript.Quit
  112. case 6
  113. 'ja
  114. wshShell.RUN "c:\skripte\Neustart.cmd"
  115. Wscript.Quit
  116. case 7
  117. ' nein
  118. Wscript.Quit
  119. end select
  120. End If
  121. Wscript.Quit

Neustart.cmd



  1. shutdown -r -t 00 -f