http://dieseyer.de • all rights reserved • © 2011 v11.4

'v2.3*****************************************************
' File: pc-restart-w9x.vbs
' Autor: dieseyer@gmx.de
' dieseyer.de
'
' 1. Scandisk über alle Laufwerke
' 2. Defragmetierung über alle Laufwerke
' 3. ShutDown mit Neustart
'*********************************************************

Option Explicit

DIM WshShell, OpSys, RegKey, TextX, ZielSys, NT_9x, Text

Set WshShell = WScript.CreateObject("WScript.Shell")

' ----------------------------------------------
' Testen der Windows-Version (XP nicht getestet)
' ----------------------------------------------

OpSys = ""
' Win9x/ME?
' ----------------------------------------------
On Error Resume Next
If not err.number <> 0 Then
OpSys = WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Productname")
End if
On Error GoTo 0

If not OpSys = "" Then
WshShell.Run "scandskw /allfixeddisks /noninteractive /silent",,True
WshShell.Run "defrag /all /f /p /noprompt",,True

' Neustart
WshShell.Run "rundll Shell32.dll,SHExitWindowsEx 7"

' Ausschalten
' WshShell.Run "rundll Shell32.dll,SHExitWindowsEx 13"

WScript.Quit
End If

' WinNT?
' ----------------------------------------------
On Error Resume Next
If not err.number <> 0 Then
OpSys = "Windows NT " & WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
End if
On Error GoTo 0

' Win2k?
' ----------------------------------------------
On Error Resume Next
If not err.number <> 0 Then
OpSys = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Productname")
End if
On Error GoTo 0

MsgBox OpSys & " wird nicht unterstützt.", , WScript.ScriptName

http://dieseyer.de • all rights reserved • © 2011 v11.4